LIL-209 - Сборка SASS с помощью webpack

remotes/origin/hasaccess
Vitaly Baev 8 years ago
parent f290e4f80e
commit f897296374
  1. 2
      web/src/js/app.js
  2. 2
      web/src/sass/helpers/_mixins.sass
  3. 21
      web/webpack.config.js

@ -13,3 +13,5 @@ import "./modules/courses";
import "./modules/comments"; import "./modules/comments";
import "./modules/password-show"; import "./modules/password-show";
import "./modules/profile"; import "./modules/profile";
import "../sass/app.sass";

@ -87,7 +87,7 @@
=font($alias, $name) =font($alias, $name)
@font-face @font-face
font-family: $alias font-family: $alias
src: url("fonts/" + $name + ".woff2") format("woff2"), url("fonts/" + $name + ".woff") format("woff") src: url("../fonts/" + $name + ".woff2") format("woff2"), url("../fonts/" + $name + ".woff") format("woff")
font-weight: normal font-weight: normal
font-style: normal font-style: normal
// to use: // to use:

@ -1,6 +1,7 @@
const webpack = require('webpack'); const webpack = require('webpack');
const path = require('path'); const path = require('path');
const NODE_ENV = process.env.NODE_ENV || 'development'; const NODE_ENV = process.env.NODE_ENV || 'development';
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = { module.exports = {
entry: { entry: {
@ -8,9 +9,10 @@ module.exports = {
courseRedactor: "./src/js/course-redactor.js" courseRedactor: "./src/js/course-redactor.js"
}, },
output: { output: {
path: path.join(__dirname, "build/js"), path: path.join(__dirname, "build"),
filename: NODE_ENV === 'development' ? '[name].js' : '[name].[id].[chunkhash].js', filename: NODE_ENV === 'development' ? '[name].js' : '[name].[id].[chunkhash].js',
library: '[name]' library: '[name]',
publicPath: '/static/',
}, },
module: { module: {
loaders: [ loaders: [
@ -32,7 +34,17 @@ module.exports = {
}, },
{ {
test: /\.css$/, test: /\.css$/,
loader: 'style-loader!css-loader' use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader']
})
},
{
test: /\.s[ac]ss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
}, },
{ {
test: /\.vue$/, test: /\.vue$/,
@ -47,7 +59,7 @@ module.exports = {
} }
}, },
{ {
test: /\.(png|gif|woff|woff2|eot|ttf|svg)$/, test: /\.(png|gif|jpg|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000' loader: 'url-loader?limit=100000'
} }
] ]
@ -63,6 +75,7 @@ module.exports = {
jQuery: "jquery", jQuery: "jquery",
"window.jQuery": "jquery" "window.jQuery": "jquery"
}), }),
new ExtractTextPlugin('[name].css'),
], ],
resolve: { resolve: {

Loading…
Cancel
Save