This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
webpack_complete_webdevelopment_config [2018/01/29 22:17] – admin | webpack_complete_webdevelopment_config [2018/02/05 22:48] (current) – [Slide 3] admin | ||
---|---|---|---|
Line 20: | Line 20: | ||
* Using custom template (index.hbs, kss-assets/ | * Using custom template (index.hbs, kss-assets/ | ||
- | ===== Yarn Commands | + | ===== Yarn ===== |
- | <code bash> | + | * Define " |
+ | * Workspace will be linked to ./ | ||
+ | * Dependencies end up in ./ | ||
+ | * Centralize/ | ||
+ | * Compatible with NPM but creates a yarn.lock file | ||
+ | * Commands are slightly different than NPMs (e.g. yarn add packageName) | ||
+ | |||
+ | <code bash Commands> | ||
- development # Build assets for development | - development # Build assets for development | ||
| | ||
- livereload | - livereload | ||
- | | + | |
- production | - production | ||
| | ||
Line 36: | Line 43: | ||
<code javascript package.json> | <code javascript package.json> | ||
{ | { | ||
- | | + | |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | }, | + | }, |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | ], |
- | " | + | |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | }, | + | " |
- | " | + | " |
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
} | } | ||
- | |||
</ | </ | ||
Line 106: | Line 116: | ||
* @type string | * @type string | ||
*/ | */ | ||
- | const corePluginBase = ' | + | const corePluginBase |
+ | const corePluginTarget | ||
if (process.env.NODE_ENV === undefined) { | if (process.env.NODE_ENV === undefined) { | ||
Line 129: | Line 140: | ||
*/ | */ | ||
pluginConfig[0] = new ExtractTextPlugin({ | pluginConfig[0] = new ExtractTextPlugin({ | ||
- | filename: '../ | + | filename: |
}); | }); | ||
const extractPlugin = pluginConfig[0]; | const extractPlugin = pluginConfig[0]; | ||
pluginConfig[8] = new ExtractTextPlugin({ | pluginConfig[8] = new ExtractTextPlugin({ | ||
- | filename: '../ | + | filename: |
}); | }); | ||
const extractKssPlugin = pluginConfig[8]; | const extractKssPlugin = pluginConfig[8]; | ||
Line 144: | Line 155: | ||
pluginConfig[2] = new sassLintPlugin({ | pluginConfig[2] = new sassLintPlugin({ | ||
glob: ' | glob: ' | ||
- | ignoreFiles: | + | ignoreFiles: |
ignorePlugins: | ignorePlugins: | ||
}); | }); | ||
Line 157: | Line 168: | ||
classNmw: ' | classNmw: ' | ||
cssFormat: ' | cssFormat: ' | ||
- | template: path.resolve(__dirname, './Templates/ | + | template: path.resolve(corePluginBase, ' |
cssTemplateFontPath: | cssTemplateFontPath: | ||
dest: { | dest: { | ||
- | fontsDir: '../ | + | fontsDir: |
- | stylesDir: path.resolve(__dirname, './Scss/' | + | stylesDir: path.resolve(corePluginBase, ' |
outputFilename: | outputFilename: | ||
} | } | ||
Line 184: | Line 195: | ||
*/ | */ | ||
pluginConfig[6] = new KssWebpackPlugin({ | pluginConfig[6] = new KssWebpackPlugin({ | ||
- | source: ['./Scss/', | + | source: [corePluginBase + ' |
- | destination: | + | destination: |
- | builder: './Templates/ | + | builder: |
homepage: ' | homepage: ' | ||
title: " | title: " | ||
css: [' | css: [' | ||
js: [' | js: [' | ||
- | custom: ' | + | custom: |
- | extend: './Templates/ | + | extend: |
}); | }); | ||
Line 203: | Line 214: | ||
files: [ | files: [ | ||
// Replace these globs with yours | // Replace these globs with yours | ||
- | '../ | + | |
- | '../ | + | |
] | ] | ||
}), | }), | ||
Line 248: | Line 259: | ||
includePaths: | includePaths: | ||
path.resolve(' | path.resolve(' | ||
- | path.resolve(' | + | path.resolve(corePluginBase + 'Scss') |
] | ] | ||
} | } | ||
Line 257: | Line 268: | ||
module.exports = { | module.exports = { | ||
entry: { | entry: { | ||
- | script: ['./JavaScript/ | + | script: [corePluginBase + ' |
}, | }, | ||
output: { | output: { | ||
path: __dirname, | path: __dirname, | ||
- | filename: "../ | + | filename: |
}, | }, | ||
resolve: { | resolve: { | ||
- | extensions: [' | + | extensions: [' |
+ | modules: [ | ||
+ | path.resolve('./ | ||
+ | | ||
}, | }, | ||
watchOptions: | watchOptions: | ||
- | ignored: ["Styleguide/**/*", "node_modules/**/*"] | + | ignored: [ /Styleguide/, / |
}, | }, | ||
module: { | module: { | ||
Line 302: | Line 316: | ||
plugins: pluginConfig | plugins: pluginConfig | ||
}; | }; | ||
- | |||
</ | </ | ||
+ | |||
+ | ===== The Good, the Bad ... ===== | ||
+ | |||
+ | * **Yarn** | ||
+ | * Workspaces | ||
+ | * Smart caching (??) | ||
+ | * Works flawlessly with existing package.json | ||
+ | * **Webpack**: | ||
+ | * Webpack lets you use require() on local " | ||
+ | * https:// |