Skip to content

Instantly share code, notes, and snippets.

@stlk
Created August 29, 2016 14:56
Show Gist options
  • Save stlk/d329cee3f067ccac1fc9250789220a70 to your computer and use it in GitHub Desktop.
Save stlk/d329cee3f067ccac1fc9250789220a70 to your computer and use it in GitHub Desktop.
SASS compilation using webpack
{
"name": "cool-project",
"version": "1.0.0",
"description": "",
"main": "webpack.js",
"dependencies": {
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"html-webpack-plugin": "^2.22.0",
"sass-loader": "^4.0.0",
"style-loader": "^0.13.1",
"svg-url-loader": "^1.1.0"
},
"devDependencies": {
"node-sass": "^3.8.0",
"webpack": "^1.13.1",
"webpack-dashboard": "^0.1.6",
"webpack-dev-server": "^1.14.1"
},
"scripts": {
"start": "webpack-dashboard -- webpack-dev-server --config webpack-dev-server.js",
"build": "webpack --config webpack-production.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
var webpack = require('webpack'),
path = require('path'),
nodeModulesPath = path.join(__dirname, 'node_modules'),
HtmlWebpackPlugin = require('html-webpack-plugin');
var DashboardPlugin = require('webpack-dashboard/plugin');
module.exports = {
debug: true,
verbose: true,
watch: true,
entry: [
'./entry.js',
],
output: {
filename: 'bundle.js'
},
resolve: {
modulesDirectories: ['node_modules'],
},
module: {
loaders: [
{ test: /\.sass$/, loader: 'style!css!sass?indentedSyntax' },
{ test: /\.scss$/, loader: 'style!css!sass' },
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.(png|jpg|jpeg|gif)$/, loader: 'url?limit=8192' },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "svg-url-loader" }
]
},
devServer: {
info: true,
hot: true
},
plugins: [
new DashboardPlugin(),
new HtmlWebpackPlugin({
inject: 'body',
template: 'index.html'
}),
]
};
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'./entry.js'
],
output: {
path: __dirname + "/dist",
filename: "[name].js",
},
module: {
loaders: [
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css!sass') },
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.(png|jpg|jpeg|gif)$/, loader: 'url?limit=8192' },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "svg-url-loader" }
]
},
plugins: [
new ExtractTextPlugin("[name].css"),
new HtmlWebpackPlugin({
inject: 'body',
template: 'index.html'
})
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment