GVKun编程网logo

无法在“ html-webpack-plugin-before-html-processing”处注册插件(无法在web.xml或使用此应用)

3

在这篇文章中,我们将为您详细介绍无法在“html-webpack-plugin-before-html-processing”处注册插件的内容,并且讨论关于无法在web.xml或使用此应用的相关问题。

在这篇文章中,我们将为您详细介绍无法在“ html-webpack-plugin-before-html-processing”处注册插件的内容,并且讨论关于无法在web.xml或使用此应用的相关问题。此外,我们还会涉及一些关于645 webpack常用plugins:clean-webpack-plugin,html-webpack-plugin,webpack.DefinePlugin,copy-webpack-plug、:before/:after与::before/::after的区别 和属性content:值、C++ cin a float before a string 不起作用,但 cin a string before 起作用为什么?、Encore Webpack - 使用 copy-webpack-plugin的知识,以帮助您更全面地了解这个主题。

本文目录一览:

无法在“ html-webpack-plugin-before-html-processing”处注册插件(无法在web.xml或使用此应用)

无法在“ html-webpack-plugin-before-html-processing”处注册插件(无法在web.xml或使用此应用)

如何解决无法在“ html-webpack-plugin-before-html-processing”处注册插件

我在项目中运行“ npm start”,并收到以下错误消息:

Plugin Could not be registered at ''html-webpack-plugin-before-html-processing''. Hook was not found.
BREAKING CHANGE: There need to exist a hook at ''this.hooks''. To create a compatibility layer for this hook,hook into ''this._pluginCompat''.

645 webpack常用plugins:clean-webpack-plugin,html-webpack-plugin,webpack.DefinePlugin,copy-webpack-plug

645 webpack常用plugins:clean-webpack-plugin,html-webpack-plugin,webpack.DefinePlugin,copy-webpack-plug

-

  • 前端小菜鸟,喜欢前端,不断学习
  • 微信:jie178463596
  • 微信小群:纯粹讨论技术、面试、工作为主,划水少,拒绝广告

认识Plugin


CleanWebpackPlugin


HtmlWebpackPlugin


生成的index.html分析


自定义HTML模板


自定义模板数据填充


DefinePlugin的介绍


DefinePlugin的使用


copyWebpackPlugin


目录结构


wk.config.js

const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { DefinePlugin } = require('webpack'); // DefinePlugin是webpack内置插件
const copyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
  entry: "./src/main.js",
  output: {
    filename: "js/bundle.js",
    // 必须是一个绝对路径
    path: path.resolve(__dirname, "./build"),
    // assetmodulefilename: "img/[name].[hash:6][ext]"
  },
  module: {
    rules: [
      {
        // 规则使用正则表达式
        test: /\.css$/, // 匹配资源
        use: [
          // { loader: "css-loader" },
          // 注意: 编写顺序(从下往上, 从右往做, 从后往前)
          "style-loader",
          {
            loader: "css-loader",
            options: {
              importLoaders: 1
            }
          },
          "postcss-loader"
        ],
        // loader: "css-loader"
      },
      {
        test: /\.less$/,
        use: [
          "style-loader",
          {
            loader: "css-loader",
            options: {
              importLoaders: 2
            }
          },
          "postcss-loader",
          "less-loader"
        ]
      },
      {
        test: /\.(png|jpe?g|gif|svg)$/,
        // type: "asset/resource", file-loader的效果
        // type: "asset/inline", url-loader
        type: "asset",
        generator: {
          filename: "img/[name].[hash:6][ext]"
        },
        parser: {
          dataUrlCondition: {
            maxSize: 100 * 1024
          }
        }
      },
      {
        test: /\.ttf|eot|woff2?$/i,
        type: "asset/resource",
        generator: {
          filename: "font/[name].[hash:6][ext]"
        }
      }
    ]
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      title: "哈哈 webpack",
      template: "./public/index.html"
    }),
    new DefinePlugin({
      // 要包裹两层引号
      BASE_URL: '"./"'
    }),
    new copyWebpackPlugin({
      patterns: [
        {
          // to: xxx, // 不用写,默认会使用output.path
          from: "public",
          globOptions: {
            ignore: [
              "**/index.html",
              "**/.DS_Store",
              "**/abc.txt"
            ]
          }
        }
      ]
    })
  ]
}


publuc/index.html

<!DOCTYPE html>
<html lang="">
  <head>
    <Meta charset="utf-8">
    <Meta http-equiv="X-UA-Compatible" content="IE=edge">
    <Meta name="viewport" content="width=device-width,initial-scale=1.0">
    
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    
    <title><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>

build/index.html

<!DOCTYPE html>
<html lang="">
  <head>
    <Meta charset="utf-8">
    <Meta http-equiv="X-UA-Compatible" content="IE=edge">
    <Meta name="viewport" content="width=device-width,initial-scale=1.0">
    
    <link rel="icon" href="./favicon.ico">
    
    <title>杰帅的webpack</title>
  <script defer src="js/bundle.js"></script></head>
  <body>
    <noscript>
      <strong>We're sorry but 杰帅的webpack doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>

:before/:after与::before/::after的区别 和属性content:值

:before/:after与::before/::after的区别 和属性content:值

一、伪元素和伪类是非常相像的两个东西。在实际上 css3 为了区分两者,已经明确规定了伪类用一个冒号来表示,而伪元素则用两个冒号来表示。

:Pseudo-classes
::Pseudo-elements

但因为兼容性的问题,所以现在大部分还是统一的单冒号,但是抛开兼容性的问题,我们在书写时应该尽可能养成好习惯,区分两者。

 

二、基本用法:

p::after{} 
img::before{}

这两个伪类下特有的属性 content ,用于在 CSS 渲染中向元素逻辑上的头部或尾部添加内容。注意这些添加不会改变文档内容,不会出现在 DOM 中,不可复制,仅仅是在 CSS 渲染层加入。

注:img使用content:的attr()/url()时不用加::after/::before

  input没有content属性

content的内容一般可以为以下四种:

 none: 不生成任何值。
 attr(): 插入标签属性值。通常和自定义属性data-配合使用,因为传统的其它属性虽然也能存值,但通常不适合存放表达性文字。括号内不加引号。
  <div data-line="1"></div>
     div[data-line]:after { content: attr(data-line);/* 属性名称上不要加引号! */ 
 url(): 使用指定的绝对或相对地址插入一个外部资源(图像,声频,视频或浏览器支持的其他任何资源)。括号内不加引号。
 string: 插入字符串。加引号。
counter():调用计数器,可以不适用列表元素实现序号功能。具体参见counter-increment和counter-reset属性的用法。
 h2:before { counter-increment: chapter; content: "Chapter " counter(chapter) ". " }

二、进阶用法:

1.清除浮动

.clearfix {*zoom: 1;}

.clearfix:before,
.clearfix:after {
    display: table;
    line-height: 0;
    content: "";
}

.clearfix:after {
    clear: both;
}

 

2.制作三角:

.c-main:before{    
    content: '''';    
    border-top: 9px solid transparent;/*方框上部分背景颜色为透明*/
    border-bottom: 9px solid transparent;/*方框下部分背景为透明*/
    border-right: 9px solid #eee;/*箭头背景颜色*/
    position: absolute;/*绝对定位1*/
    top: 25px;/*距离顶部位置偏移量2*/
    left: -9px;/*距离左边位置偏移量3*/ /*123都是控制显示位置的*/
    }

.c-main:after{ content: ''''; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-right: 7px solid #fbfdfb;/*箭头背景颜色,覆盖前面的#eee颜色,使其颜色与整体颜色一致*/ position: absolute; top: 27px; left: -7px; }

3. css 里添加  iconfont图标:

在 content:"  ";  里写css的图标转译字符。例子:content:" \e673";

要点:把下载后的iconfont类名下面的”初始定义“复制一份给自定义伪类before,才能生效。

C++ cin a float before a string 不起作用,但 cin a string before 起作用为什么?

C++ cin a float before a string 不起作用,但 cin a string before 起作用为什么?

如何解决C++ cin a float before a string 不起作用,但 cin a string before 起作用为什么??

不起作用:

#include <iostream>
#include <string>
using namespace std;

int main() {
  
  string planet;
  double weight;

  cout << "What is your earth weight?\n";
  cin >> weight;
  cout << "What planet do you want to fight on? ";
  getline (cin,planet);
  cout << "your planet is " << planet << "\n";
}

作品:

#include <iostream>
#include <string>
using namespace std;

int main() {
  
  string planet;
  double weight;

  cout << "What planet do you want to fight on? ";
  getline (cin,planet);
  cout << "your planet is " << planet << "\n";
  cout << "What is your earth weight?\n";
  cin >> weight;
}

以第一种方式运行它会在打印“你想在哪个星球上战斗?”后终止程序。我的问题是:为什么它是第二种方式而不是第一种方式?和c++的编译方式有关系吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

Encore Webpack - 使用 copy-webpack-plugin

Encore Webpack - 使用 copy-webpack-plugin

如何解决Encore Webpack - 使用 copy-webpack-plugin

我正在使用 Symfony 5 和 copy-webpack-plugin。我想将此结构从资产/字体复制到 public/build/fonts :

资产
----字体
--------文件夹1
------------subFolder1.1
----------------file1.1.1
----------------file1.1.2
------------file1.2
------------file1.3
--------文件夹2
------------subFolder2.1
----------------file2.1.1
----------------file2.1.2
------------file2.2
------------file2.3
--------file3
--------文件4

我有这个 webpack 配置:

const copyWebpackPlugin = require(''copy-webpack-plugin'');

  1. .addplugin(new copyWebpackPlugin(
  2. [{
  3. patterns: [{
  4. from: ''**/*.*'',to: ''fonts'',context: ''./fonts'',force: true
  5. }]
  6. }],{
  7. copyUnmodified: true
  8. }
  9. ))

然而,它不起作用。我尝试了很多不同的配置,都无济于事。

我们今天的关于无法在“ html-webpack-plugin-before-html-processing”处注册插件无法在web.xml或使用此应用的分享就到这里,谢谢您的阅读,如果想了解更多关于645 webpack常用plugins:clean-webpack-plugin,html-webpack-plugin,webpack.DefinePlugin,copy-webpack-plug、:before/:after与::before/::after的区别 和属性content:值、C++ cin a float before a string 不起作用,但 cin a string before 起作用为什么?、Encore Webpack - 使用 copy-webpack-plugin的相关信息,可以在本站进行搜索。

本文标签: