Last active
August 12, 2017 21:22
-
-
Save Khangeldy/be43ec955624275127c0e86d5028b904 to your computer and use it in GitHub Desktop.
Postcss webpack simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Start it", | |
"version": "1.0.0", | |
"description": "project starter for static scaffolding", | |
"main": "dist/js/bundle.js", | |
"scripts": { | |
"start": "webpack --watch", | |
"build": "webpack", | |
"build:prod": "webpack -p --config webpack.config.prod.js", | |
"watch": "webpack --progress --watch", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Khangeldy Ilebaev <hongeldon@inbox.ru>", | |
"license": "ISC", | |
"devDependencies": { | |
"babel-core": "^6.24.1", | |
"babel-loader": "^7.0.0", | |
"babel-preset-env": "^1.4.0", | |
"browser-sync": "^2.18.8", | |
"browser-sync-webpack-plugin": "^1.1.4", | |
"copy-webpack-plugin": "^4.0.1", | |
"css-loader": "^0.28.0", | |
"css-mqpacker": "^6.0.1", | |
"ejs": "^2.5.6", | |
"ejs-render-loader": "^1.0.0", | |
"extract-text-webpack-plugin": "^2.1.0", | |
"file-loader": "^0.11.1", | |
"html-webpack-plugin": "^2.29.0", | |
"imagemin-webpack-plugin": "^1.4.4", | |
"postcss-cssnext": "^2.10.0", | |
"postcss-import": "^9.1.0", | |
"postcss-loader": "^1.3.3", | |
"style-loader": "^0.16.1", | |
"stylelint-config-standard": "^16.0.0", | |
"uglifyjs-webpack-plugin": "^0.4.3", | |
"url-loader": "^0.5.8", | |
"webpack": "^2.4.1" | |
}, | |
"dependencies": { | |
"gsap": "^1.19.1", | |
"jquery": "^3.2.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var path = require('path'); | |
var BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
entry: ['./src/App.js'], | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist/assets'), | |
publicPath: './assets/' | |
}, | |
devtool: 'inline-source-map', | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx$|\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
options: {} | |
}, | |
{ | |
test: /\.css$/, | |
use: ExtractTextPlugin.extract({ | |
fallback: 'style-loader', | |
use: [ | |
{ | |
loader: 'css-loader', | |
options: { | |
importLoaders: 1, | |
sourceMap: true | |
} | |
}, | |
'postcss-loader' | |
], | |
publicPath: './' | |
}) | |
}, | |
{ | |
test: /\.(jpg|png|gif)$/, | |
use: 'file-loader' | |
}, | |
{ | |
test: /\.(woff|woff2|eot|ttf|svg)$/, | |
use: { | |
loader: 'url-loader', | |
options: { | |
limit: 100000 | |
} | |
} | |
}, | |
{ | |
test: /\.ejs$/, | |
exclude: /node_modules/, | |
loader: 'ejs-render-loader' | |
} | |
] | |
}, | |
plugins: [ | |
new ExtractTextPlugin('style.css'), | |
new HtmlWebpackPlugin({ | |
filename: '../index.html', | |
template: 'src/ejs/index.ejs' | |
}), | |
// new webpack.optimize.UglifyJsPlugin({}), | |
new BrowserSyncPlugin({ | |
host: 'localhost', | |
port: 3000, | |
server: {baseDir: ['dist']} | |
}) | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
plugins: [ | |
require('postcss-import'), | |
require('postcss-cssnext')({ /* ...options */ }), | |
require('css-mqpacker') | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment