فهرست منبع

webpack config SCSS

John 8 سال پیش
والد
کامیت
599b79046b
2فایلهای تغییر یافته به همراه9 افزوده شده و 2 حذف شده
  1. 1 1
      src/routes/index.js
  2. 8 1
      tools/webpack.config.js

+ 1 - 1
src/routes/index.js

@@ -1,5 +1,5 @@
 // We only need to import the modules necessary for initial render
-import CoreLayout from '../layouts/CoreLayout/CoreLayout'
+import CoreLayout from '../layouts/CoreLayout'
 import Home from './Home'
 import CounterRoute from './Counter'
 

+ 8 - 1
tools/webpack.config.js

@@ -133,7 +133,14 @@ const config = {
         test: /\.scss$/,
         loaders: [
           'style-loader',
-          `css-loader?${JSON.stringify({ sourceMap: DEBUG, minimize: !DEBUG })}`,
+          `css-loader?${JSON.stringify({
+            sourceMap: DEBUG,
+            // CSS Modules https://github.com/css-modules/css-modules
+            modules: true,
+            localIdentName: DEBUG ? '[name]_[local]_[hash:base64:3]' : '[hash:base64:4]',
+            // CSS Nano http://cssnano.co/options/
+            minimize: !DEBUG,
+          })}`,
           'postcss-loader?pack=sass',
           'sass-loader',
         ],