Last active
September 2, 2020 12:15
-
-
Save RahulDey12/ee6359dc038a9c4de9b083b7ce3f44d3 to your computer and use it in GitHub Desktop.
SASS, JS Starter
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
{ | |
"private": true, | |
"scripts": { | |
"dev": "webpack --progress --mode=development", | |
"watch": "npm run dev -- --watch", | |
"dist": "webpack -p --mode=production" | |
}, | |
"devDependencies": { | |
"@babel/core": "^7.9.0", | |
"@babel/preset-env": "^7.9.5", | |
"autoprefixer": "^9.7.6", | |
"babel-loader": "^8.1.0", | |
"css-loader": "^3.5.1", | |
"file-loader": "^4.2.0", | |
"mini-css-extract-plugin": "^0.8.0", | |
"node-sass": "^4.14.1", | |
"optimize-css-assets-webpack-plugin": "^5.0.3", | |
"postcss-loader": "^3.0.0", | |
"sass-loader": "^7.3.1", | |
"terser-webpack-plugin": "^1.4.2", | |
"webpack": "^4.42.1", | |
"webpack-cli": "^3.3.11" | |
}, | |
"browserslist": [ | |
"defaults", | |
"not ie < 11", | |
"last 2 versions", | |
"> 1%", | |
"iOS 7", | |
"last 3 iOS versions" | |
] | |
} |
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('autoprefixer') | |
] | |
}; |
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
const path = require('path'); | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const TerserPlugin = require('terser-webpack-plugin'); | |
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | |
const webpack = require('webpack'); | |
module.exports = { | |
entry: './src/js/app.js', | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
filename: './js/app.js', | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/, | |
options: { | |
presets: ['@babel/preset-env'] | |
} | |
}, | |
{ | |
test: /\.(sa|sc|c)ss$/, | |
use: [ | |
{ | |
loader: MiniCssExtractPlugin.loader, | |
options: { | |
hmr: process.env.NODE_ENV === 'development', | |
} | |
}, | |
'css-loader', | |
{ | |
loader: 'postcss-loader', | |
options: { | |
config: { | |
path: 'postcss.config.js' | |
} | |
} | |
}, | |
'sass-loader', | |
], | |
}, | |
{ | |
test: /\.(jpg|png|webp|ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, | |
use: [ | |
{ | |
loader: 'file-loader', | |
options: { | |
publicPath: '../public/', | |
outputPath: 'public' | |
} | |
} | |
] | |
} | |
] | |
}, | |
optimization: { | |
minimizer: [new TerserPlugin({}), new OptimizeCSSAssetsPlugin({})], | |
}, | |
plugins: [ | |
new MiniCssExtractPlugin({ | |
// Options similar to the same options in webpackOptions.output | |
// both options are optional | |
filename: './css/[name].css', | |
}), | |
], | |
stats: { | |
colors: true | |
}, | |
devtool: 'source-map' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment