Simplify Webpack CSS

This commit is contained in:
Alex Gleason
2020-05-31 23:09:21 -05:00
parent 4ddcb9bcd0
commit 9d242a403b
6 changed files with 3 additions and 448 deletions

View File

@@ -1,2 +0,0 @@
azure: styles/azure.scss
purple-dark: styles/application.scss

View File

@@ -8,9 +8,6 @@ const { readFileSync } = require('fs');
const configPath = join(__dirname, 'config', 'webpacker.yml');
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
const themePath = join(__dirname, 'config', 'themes.yml');
const themes = safeLoad(readFileSync(themePath), 'utf8');
function removeOuterSlashes(string) {
return string.replace(/^\/*/, '').replace(/\/*$/, '');
}
@@ -31,7 +28,6 @@ const output = {
module.exports = {
settings,
themes,
env: {
CDN_HOST: env.CDN_HOST,
NODE_ENV: env.NODE_ENV,

View File

@@ -7,7 +7,7 @@ const AssetsManifestPlugin = require('webpack-assets-manifest');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
const extname = require('path-complete-extname');
const { env, settings, themes, output } = require('./configuration');
const { env, settings, output } = require('./configuration');
const rules = require('./rules');
const localePackPaths = require('./generateLocalePacks');
@@ -19,10 +19,7 @@ module.exports = {
localMap[basename(entry, extname(entry, extname(entry)))] = resolve(entry);
return localMap;
}, {}),
Object.keys(themes).reduce((themePaths, name) => {
themePaths[name] = resolve(join(settings.source_path, themes[name]));
return themePaths;
}, {})
{ styles: resolve(join(settings.source_path, 'styles/application.scss')) }
),
output: {
@@ -78,10 +75,9 @@ module.exports = {
}),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
inject: false,
template: 'app/index.ejs',
chunksSortMode: 'manual',
chunks: ['common', 'locale_en', 'application', 'azure'],
chunks: ['common', 'locale_en', 'application', 'styles'],
alwaysWriteToDisk: true,
}),
new HtmlWebpackHarddiskPlugin({