postcss

webpack with less and postcss autoprefixer

丶灬走出姿态 提交于 2019-12-01 00:34:33
I'm new to webpack and I'm trying to set everything up to work on a react project. I have managed to get everything working in webpack as expected but have hit a road block with autoprefixer. I have followed the docs for both post css and autoprefixer and I'm obviously missing something important here or have done something daft. can you please take a look at my config and let me know if you have any suggestions. Other postcss plugins are working fine like nanocss. althought I have tried cssnext as I think that includes autoprefixer anyway. I'm assuming it's a autoprefixer config issue.

webpack 静态资源集中输出的方法示例

与世无争的帅哥 提交于 2019-11-30 18:34:05
目录结构 copy-webpack-plugin 工作中会有一些已经存在但在项目中没有引用的图片资源或者其他静态资源(比如设计图、开发文档),这些静态资源有可能是文档,也有可能是一些额外的图片。打包时保留这些静态资源,直接打包到制定文件夹 安装依赖 cnpm install copy-webpack-plugin --save-dev webpack.config.js from:要打包的静态资源目录地址,这里的__dirname是指项目目录下,是node的一种语法,可以直接定位到本机的项目目录中。 to:要打包到的文件夹路径,跟随output配置中的目录。所以不需要再自己加__dirname。 const copyWebpackPlugin = require('copy-webpack-plugin'); ... plugins: [ new copyWebpackPlugin([{ from: __dirname + '/src/public', to:'./public' }]) ], 打包,运行 npm run build npm run server webpack.config.js全部代码 const path = require('path'); const glob = require('glob'); const uglify = require(

webpack4 入门

时光怂恿深爱的人放手 提交于 2019-11-30 18:03:52
webpack模块打包 npm init touch index.html touch index.js touch header.js touch content.js touch sidebar.js npm install webpack-cli --save-dev npm install webpack --save npx webpack index.js 源码地址 https://github.com/lilugirl/learn-webpack4/tree/master/3 用webpack编译index.js文件生成目录dist和main.js文件 使用CommonJS的模块引入方式打包源码 https://github.com/lilugirl/learn-webpack4/tree/master/4 常用命令 全局安装webpack npm install webpack webpack-cli -g 卸载全局webpack npm uninstall webpack webpack-cli -g 查看webpack版本 npm info webpack 查看当前目录下webpck的版本 npx webpack -v webpack配置文件 在项目中创建webpack.config.js文件 ,内容如下 touch webpack.config.js

Webpack not loading css

拜拜、爱过 提交于 2019-11-30 17:18:43
This is my first time trying to set up Webpack, so I'm sure I'm missing something here. I am trying to load my PostCSS files with Webpack, using the ExtractTextPlugin to generate a css file into "dist". The problem is Webpack does not seem to pick up the css files. They are under "client/styles", but I've tried moving them to "shared", with the same result. I ran Webpack with the --display-modules option, and verified that no css files display there. I have tried running it without the extract text plugin, and the result is the same: no CSS is built into bundle.js. Here is my prod config: var

Switching from Gulp to Webpack

纵然是瞬间 提交于 2019-11-30 08:28:57
My first question is about how recommended is this switch for simple projects, just to Pre-Process/Concat/Minify? Understanding this future "standards", like Webpack in together with PostCss-NextCss-Autoprefixer, etc. is like obsessing me.... So this leads to my next question , is there any tutorial that will guide to simple tasks like the one I told in my first question? Or is an easy way to change my gulpfile.js to a webpack-config.js My normal tasks in gulp are not the best practices but work well : //load plugins var gulp = require('gulp'), runSequence = require('run-sequence'), sass =

Webpack not loading css

痴心易碎 提交于 2019-11-30 01:30:51
问题 This is my first time trying to set up Webpack, so I'm sure I'm missing something here. I am trying to load my PostCSS files with Webpack, using the ExtractTextPlugin to generate a css file into "dist". The problem is Webpack does not seem to pick up the css files. They are under "client/styles", but I've tried moving them to "shared", with the same result. I ran Webpack with the --display-modules option, and verified that no css files display there. I have tried running it without the

寻找丢失的孩子,这条漫漫长路,何时才是终点

余生长醉 提交于 2019-11-29 22:23:24
  项目名称      树洞(tree-hole)      项目背景      有些话不适合对任何人说,何不对着树洞发泄一下。      树洞的想法源自于一个朋友对知己的看法,最初设计有一点像漂流瓶。不过,这样的想法有一点傻。如果要严格匹配出一个知己需要大量的用户,需要大数据支持,一个初级产品是不可能有如此的用户群。于是,我联想到了电影《解忧杂货铺》,这样就可以避开大数据,同时对不法行为也是一种拦截。当然,如果要做成一个成型的产品需要一个漫长的过程。      这样的产品在市面上是存在的,有成功的,也有失败的。当我开始做个项目的时候也并没有要把它做完整,毕竟想法不完整,同时还需要进行一些必要的知识补救。也就是说这只是一个Demo,并不完整的东西,仅仅是为了练习一下技术。最初也想做成一个完整的项目,而且也聚集了一些朋友,不过做到后面有些不尽人意了。大家抱着不挣钱练技术的心态是建设不出好的项目来,而且我觉得主要工作在后端。另外,大家也似乎都很忙,沟通成本也太高了,只好作罢。      所以,在这儿也就不做项目的结构介绍,等做成完整项目之后再做一个全面的输出。毕竟只有一个人弄,还要去学后端,这是又一个漫长的过程。      技术选型      近期主要研究的是vue,之前对比过vue-cli2和vue-cli3的差异,vue-cli3更简洁。但是之前没有研究明白,因此这次选用vue

Switching from Gulp to Webpack

人盡茶涼 提交于 2019-11-29 11:45:46
问题 My first question is about how recommended is this switch for simple projects, just to Pre-Process/Concat/Minify? Understanding this future "standards", like Webpack in together with PostCss-NextCss-Autoprefixer, etc. is like obsessing me.... So this leads to my next question , is there any tutorial that will guide to simple tasks like the one I told in my first question? Or is an easy way to change my gulpfile.js to a webpack-config.js My normal tasks in gulp are not the best practices but

create-react-app 项目基本配置

非 Y 不嫁゛ 提交于 2019-11-28 15:47:01
目录 开发 eslint配置 代码调试 自动格式化代码pretty 隔离开发组件 分析Bundle包大小 样式和资源 SASS postcss / autoprefixer PostCSS Normalize 添加图片,字体和文件 添加svg Loading .graphql Files 使用public文件夹 何时使用 代码拆分 构建APP 导入 Absolute Imports 调整bootstrap样式 添加 TypeScript 添加自定义环境变量 在HTML中使用 在 .env 中添加开发环境变量 设置开发代理 手动配置代理 fetch/axios You need to put any JS and CSS files inside src , otherwise Webpack won’t see them. webpack只负责管理src文件夹下的内容,因此只能在src文件夹下创建子文件夹进行开发 Only files inside public can be used from public/index.html . 只有public文件夹下的内容能够被index.html引用 需要安装react-app-polyfill 才能够使用es6+的语法 When editing the browserslist config, you may notice that

tailwiind init

牧云@^-^@ 提交于 2019-11-28 12:57:02
1. init npm init -y npm install tailwindcss postcss-cli autoprefixer npx tailwind init 2. postcss.config.js const purgecss = require('@fullhuman/postcss-purgecss')({ content: [ './src/**/*.html', './src/**/*.vue', ], defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [] }) module.exports = { plugins: [ require('tailwindcss'), require('autoprefixer'), ...process.env.NODE_ENV === 'production' ? [purgecss] : [] ] } 3. src/css/tailwind.css @tailwind base; @tailwind components; @tailwind utilities; 4. package.json "scripts": { "dev": "postcss src/css/tailwind.css -o public/css/all