Skip to content

Instantly share code, notes, and snippets.

@liitfr
Last active March 18, 2019 13:03
Show Gist options
  • Save liitfr/edc702962460ddf23accac3a0eaea4ad to your computer and use it in GitHub Desktop.
Save liitfr/edc702962460ddf23accac3a0eaea4ad to your computer and use it in GitHub Desktop.
[multiple entries with spike] #spike
const htmlStandards = require('reshape-standard')
const cssStandards = require('spike-css-standards')
const jsStandards = require('spike-js-standards')
const pageId = require('spike-page-id')
const { _ } = require('lodash')
const env = process.env.NODE_ENV
const entries = Object.assign({}, ..._.map(_.filter(fs.readdirSync('./assets/js/'), file => file.charAt(0) !== '_'), file =>
_.fromPairs([[`js/${path.parse(file).name}`, `./assets/js/${file}`]])))
module.exports = {
devtool: 'source-map',
matchers: { html: '*(**/)*.sgr', css: '*(**/)*.sss' },
ignore: ['**/layout.sgr', '**/_*', '**/.*', 'readme.md', 'yarn.lock'],
reshape: htmlStandards({
locals: (ctx) => { return { pageId: pageId(ctx), foo: 'bar' } },
minify: env === 'production'
}),
postcss: cssStandards({
minify: env === 'production',
warnForDuplicates: env !== 'production'
}),
babel: jsStandards(),
entries
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment