当前位置: 首页 > news >正文

网站正能量免费推广软件wordpress amp

网站正能量免费推广软件,wordpress amp,安徽网站推广,dns可以将网站域名解析上一篇博客讲解了webpack环境的基本#xff0c;这一篇讲解一些更深入的内容和开发技巧。基本环境搭建就不展开讲了 一、插件篇 1. 自动补全css3前缀 autoprefixer 官方是这样说的#xff1a;Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use… 上一篇博客讲解了webpack环境的基本这一篇讲解一些更深入的内容和开发技巧。基本环境搭建就不展开讲了 一、插件篇 1. 自动补全css3前缀 autoprefixer 官方是这样说的Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website也就是说它是一个自动检测兼容性给各个浏览器加个内核前缀的插件。 举个栗子最新的弹性盒模型flux实际代码 :fullscreen a {display: flex } 插件自动补充后 a {display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex } 效果显而易见我们可以更专注于css布局和美化而不需要花过多的精力都写相同的外码而加上不同的前缀也减少了冗余代码。 使用方法: cnpm install --save-dev autoprefixer postcss-loader var autoprefixer require(autoprefixer); module.exports{//其他配置这里就不写了module:{loaders:[{test:/\.css$/,//在原有基础上加上一个postcss的loader就可以了loaders:[style-loader,css-loader,postcss-loader]}]},postcss:[autoprefixer({browsers:[last 2 versions]})]} 2. 自动生成html插件 html-webpack-plugin cnpm install html-webpack-plugin --save-dev //webpack.config.jsvar HtmlWebpackPlugin require(html-webpack-plugin);module.exports{entry:./index.js,output:{path:__dirname/dist,filename:bundle.js}plugins:[new HtmlWebpackPlugin()]} 作用:它会在dist目录下自动生成一个index.html !DOCTYPE html htmlheadmeta charsetUTF-8titleWebpack App/title/headbodyscript srcbundle.js/script/body /html 其他配置参数: {entry: index.js,output: {path: dist,filename: bundle.js},plugins: [new HtmlWebpackPlugin({title: My App,filename: admin.html,template:header.html,inject: body,favicon:./images/favico.ico,minify:true,hash:true,cache:false,showErrors:false,chunks: {head: {entry: assets/head_bundle.js,css: [ main.css ]},xhtml:false})] } --- header.html --- !DOCTYPE html htmlheadmeta http-equivContent-type contenttext/html; charsetutf-8/title% htmlWebpackPlugin.options.title %/title/headbody/body /html 作用 title: 设置title的名字 filename: 设置这个html的文件名 template:要使用的模块的路径 inject: 把模板注入到哪个标签后 body, favicon: 给html添加一个favicon ./images/favico.ico, minify:是否压缩 {...} | false 最新api变动原来是ture|false 感谢onmi指正)hash:是否hash化 true false , cache:是否缓存, showErrors:是否显示错误, chunks:目前没太明白 xhtml:是否自动毕业标签 默认false 3. 提取样式插件 extract-text-webpack-plugin 官网是这么解释的Extract text from bundle into a file.,把额外的数据加到编译好的文件中 var ExtractTextPlugin require(extract-text-webpack-plugin); module.exports {module: {loaders: [{ test: /\.css$/, loader: ExtractTextPlugin.extract(style-loader, css-loader) }]},plugins: [new HtmlWebpackPlugin({template: ./src/public/index.html,inject: body}),new ExtractTextPlugin([name].[hash].css)] } 说明将css放到index.html的body上面 4. 拷贝资源插件 copy-webpack-plugin 官方这样解释 Copy files and directories in webpack,在webpack中拷贝文件和文件夹 cnpm install --save-dev copy-webpack-pluginnew CopyWebpackPlugin([{from: __dirname /src/public }]), 作用把public 里面的内容全部拷贝到编译目录 参数作用其他说明from定义要拷贝的源目录from: __dirname /src/publicto定义要烤盘膛的目标目录from: __dirname /disttoType file 或者 dir 可选默认是文件force强制覆盖先前的插件可选 默认falsecontext不知道作用可选 默认 base context 可用 specific contextflatten只拷贝文件不管文件夹默认是falseignore忽略拷贝指定的文件可以用模糊匹配5. 全局挂载插件 webpack.ProvidePlugin [webpack内置插件 ] new webpack.ProvidePlugin({$: jquery,jQuery: jquery,window.jQuery: jquery })) new webpack.NoErrorsPlugin(), new webpack.optimize.DedupePlugin(), new webpack.optimize.UglifyJsPlugin(), new webpack.optimize.CommonsChunkPlugin(common.js) 作用: 和上面5个一一对应 当模块使用这些变量的时候,wepback会自动加载。区别于window挂载感谢lihuanghe121指正不显示错误插件查找相等或近似的模块避免在最终生成的文件中出现重复的模块丑化js 混淆代码而用提取公共代码的插件 二、一个完整的栗子 use strict;// Modules var webpack require(webpack); var autoprefixer require(autoprefixer); var HtmlWebpackPlugin require(html-webpack-plugin); var ExtractTextPlugin require(extract-text-webpack-plugin); var CopyWebpackPlugin require(copy-webpack-plugin);/*** Env* Get npm lifecycle event to identify the environment*/ var ENV process.env.npm_lifecycle_event; var isTest ENV test || ENV test-watch; var isProd ENV build;module.exports function makeWebpackConfig() {var config {};config.entry isTest ? {} : {app: ./src/app/app.js};config.output isTest ? {} : {// Absolute output directorypath: __dirname /dist,publicPath: isProd ? / : http://localhost:8080/,filename: isProd ? [name].[hash].js : [name].bundle.js,chunkFilename: isProd ? [name].[hash].js : [name].bundle.js};if (isTest) {config.devtool inline-source-map;} else if (isProd) {config.devtool source-map;} else {config.devtool eval-source-map;}config.module {preLoaders: [],loaders: [{test: /\.js$/,loader: babel,exclude: /node_modules/}, {test: /\.css/,loader: isTest ? null : ExtractTextPlugin.extract(style, css?sourceMap!postcss)}, {test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/,loader: file}, {test: /\.json$/,loader: json}, {test: /\.scss/,loader: style!css!sass}, {test: /\.html$/,loader: raw}]};if (isTest) {config.module.preLoaders.push({test: /\.js$/,exclude: [/node_modules/,/\.spec\.js$/],loader: isparta-instrumenter})}config.postcss [autoprefixer({browsers: [last 2 version]})];config.plugins [];if (!isTest) {config.plugins.push(new HtmlWebpackPlugin({template: ./src/public/index.html,inject: body}),new ExtractTextPlugin([name].[hash].css, {disable: !isProd}))}if (isProd) {config.plugins.push(new webpack.NoErrorsPlugin(),new webpack.optimize.DedupePlugin(),new webpack.optimize.UglifyJsPlugin(),new CopyWebpackPlugin([{from: __dirname /src/public}]),new webpack.ProvidePlugin({$: jquery,jQuery: jquery,window.jQuery: jquery}))}config.devServer {contentBase: ./src/public,stats: minimal};return config; }();三、调试技巧 if (isTest) {config.devtool inline-source-map; } 作用: 使用source-map可以在debug的时候看到源代码方便 查错
http://www.yutouwan.com/news/441438/

相关文章:

  • 网站制作怎么赚钱seo网站分析案例
  • 江苏省交通厅门户网站建设管理办法做薪酬调查的网站
  • 网站的费用多少合适手机怎么管理wifi踢人
  • 网站服务器租赁费用Python做网站 性能
  • 深圳专业网站制作多少钱国家高新区网站建设
  • 北京软件公司排行宁波seo推广方式排名
  • 微信公众号 网站开发企业网站建设排名
  • 揭阳做网站的毕业生就业推荐表模板网站开发
  • 网站制作类软件推荐在线是免费生成网
  • 深圳外贸网站制作价格域名绑定网站提示正在建设
  • 怎么做网站宣传搜狗指数官网
  • 徐水区城市建设网站湖南关键词优化品牌推荐
  • 内网网站模板2023年的新闻十条
  • 建站宝盒 源码视觉设计师工资一般多少
  • 景区网站的作用wordpress 移动端优势
  • 站长统计app软件下载郑州今晚发布会
  • 网站ftp密码怎么修改wordpress加载jquery库
  • 学校网站开发必要性与意义wordpress多人博客
  • 呼和浩特建设工程安全管理网站引流推广怎么做
  • 外贸网站每天多少ip国家企业信息公示系统官网河南
  • 防伪码做网站的还能没导入吗能够做一镜到底的网站
  • 自己能建设网站网页设计制作方案
  • 网站建设详细步骤潍坊响应式网站建设
  • 各省网站备案条件做网站怎么把字弄图片上去
  • 合肥中小型企业网站建设方案模板沈阳建设工程招投标网
  • vps如何做网站深圳app网站建设哪家好
  • 小说网站如何赚钱建站哪家好
  • 个人做电商网站icp二手房网站怎么做才能接到电话
  • 网站建设明细报价表杭州模板做网站
  • 个旧网站建设外包网易