Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update webpack style loaders #278

Merged
merged 4 commits into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pa11yci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"defaults": {
"timeout": 20000,
"timeout": 30000,
"wait": 1000,
"standard": "WCAG2AA",
"ignore": [
Expand Down
18 changes: 8 additions & 10 deletions config/webpack/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
const webpack = require('webpack');
const merge = require('webpack-merge');
const path = require('path');
const shared = require('./webpack.shared');
const webpack = require('webpack')
const merge = require('webpack-merge')
const path = require('path')
const shared = require('./webpack.shared')

const dev = {
mode: 'development',
devtool: 'cheap-module-eval-source-map',
devtool: 'eval-source-map',
devServer: {
hot: true,
publicPath: '/',
historyApiFallback: true
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
};
plugins: [new webpack.HotModuleReplacementPlugin()]
}

module.exports = merge(shared, dev);
module.exports = merge(shared, dev)
38 changes: 28 additions & 10 deletions config/webpack/webpack.shared.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const { copyFileSync, readFileSync } = require('fs')
const { dirname, join } = require('path')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
// const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const DefinePlugin = require('webpack/lib/DefinePlugin')
const EnvironmentPlugin = require('webpack/lib/EnvironmentPlugin')
const EventHooksPlugin = require('event-hooks-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const sass = require('sass')
const autoprefixer = require('autoprefixer')
const mqpacker = require('css-mqpacker')
const get = require('lodash.get')
const { map } = require('@code.gov/cautious')

Expand Down Expand Up @@ -153,14 +155,30 @@ module.exports = {
}
},
{
test: /\.scss$/,
test: /\.(s*)css$/,
use: [
'style-loader', // creates style nodes from JS strings
{
loader: 'style-loader', // creates style nodes from JS strings
options: {
sourceMap: true
}
},
'css-loader', // translates CSS into CommonJS
{
loader: 'postcss-loader', // adds vendor prefixing
options: {
indent: 'postcss',
parser: 'postcss-scss',
sourceMap: true,
plugins: [autoprefixer({ grid: true })],
mqpacker
}
},
{
loader: 'sass-loader', // compiles Sass to CSS
options: {
implementation: sass
implementation: sass,
sourceMap: true
}
}
]
Expand Down Expand Up @@ -209,12 +227,12 @@ module.exports = {
new EnvironmentPlugin(['CODE_GOV_API_BASE', 'CODE_GOV_API_KEY', 'CODE_GOV_TASKS_URL']),
new CleanWebpackPlugin([OUTPUT_PATH], { root: rootDir }),
new CopyWebpackPlugin(patterns),
new FaviconsWebpackPlugin({
logo: './assets/img/favicon.png',
icons: {
appleStartup: false
}
}),
// new FaviconsWebpackPlugin({
// logo: './assets/img/favicon.png',
// icons: {
// appleStartup: false
// }
// }),
new HtmlWebpackPlugin({
hash: true,
template: 'index.html',
Expand Down
Loading