tidy up how optional CSS file is built

This commit is contained in:
Jeff Nusz 2016-09-01 12:50:55 -07:00
parent dbd80251f3
commit 986494ac80
4 changed files with 10 additions and 8 deletions

View File

@ -8,8 +8,10 @@
},
"scripts": {
"test": "node ./node_modules/eslint/bin/eslint.js src/",
"build": "webpack --config ./webpack/webpack.config.js --devtool sourcemap && webpack --config ./webpack/webpack.config.min.js",
"dev": "webpack --progress --colors --watch --config webpack/webpack.config.js --devtool sourcemap"
"dev": "webpack --progress --colors --watch --config webpack/webpack.config.js --devtool sourcemap",
"build": "npm run build-js && npm run build-css",
"build-js": "webpack --config ./webpack/webpack.config.js --devtool sourcemap && webpack --config ./webpack/webpack.config.min.js",
"build-css": "node-sass src/dat/gui/style.scss build/dat.gui.css"
},
"repository": {
"type": "git",

View File

@ -25,10 +25,9 @@ import CenteredDiv from '../dom/CenteredDiv';
import dom from '../dom/dom';
import common from '../utils/common';
import styleSheet from '!css!sass!./style.scss'; // CSS to embed in build
import styleSheetExternal from '!file?name=dat.gui.css!extract!css!sass!./style.scss'; // CSS as external file
import styleSheet from './style.scss'; // CSS to embed in build
css.inject(styleSheet, styleSheetExternal);
css.inject(styleSheet);
/** Outer-most className for GUI's */
const CSS_NAMESPACE = 'dg';

View File

@ -21,7 +21,7 @@ module.exports = {
doc.getElementsByTagName('head')[0].appendChild(link);
},
inject: function(css, externalCssFileName, indoc) {
inject: function(css, indoc) {
const doc = indoc || document;
const injected = document.createElement('style');
injected.type = 'text/css';

View File

@ -19,7 +19,8 @@ module.exports = {
context: path.resolve(__dirname, '..', 'src'),
entry: {
main: '../index'
main: '../index',
},
module: {
@ -48,7 +49,7 @@ module.exports = {
},
{
test: /\.scss$/,
loader: 'style!css!sass'
loader: 'css-loader!sass-loader'
}
]
},