This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| webpack_complete_webdevelopment_config [2018/02/05 20:11] – [Slide 3] admin | webpack_complete_webdevelopment_config [2018/02/05 22:48] (current) – [Slide 3] admin | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| * Define " | * Define " | ||
| - | * Workspace will be linked to ./ | + | * Workspace will be linked to ./ |
| - | * Dependenies | + | * Dependencies |
| * Centralize/ | * Centralize/ | ||
| + | * Compatible with NPM but creates a yarn.lock file | ||
| + | * Commands are slightly different than NPMs (e.g. yarn add packageName) | ||
| <code bash Commands> | <code bash Commands> | ||
| Line 31: | Line 33: | ||
| | | ||
| - livereload | - livereload | ||
| - | | + | |
| - production | - production | ||
| | | ||
| Line 41: | Line 43: | ||
| <code javascript package.json> | <code javascript package.json> | ||
| { | { | ||
| - | | + | |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | }, | + | }, |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | ], |
| - | " | + | |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | " | + | " |
| - | }, | + | " |
| - | " | + | " |
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| } | } | ||
| - | |||
| </ | </ | ||
| Line 111: | 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 134: | 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 149: | Line 155: | ||
| pluginConfig[2] = new sassLintPlugin({ | pluginConfig[2] = new sassLintPlugin({ | ||
| glob: ' | glob: ' | ||
| - | ignoreFiles: | + | ignoreFiles: |
| ignorePlugins: | ignorePlugins: | ||
| }); | }); | ||
| Line 162: | 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 189: | 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 208: | Line 214: | ||
| files: [ | files: [ | ||
| // Replace these globs with yours | // Replace these globs with yours | ||
| - | '../ | + | |
| - | '../ | + | |
| ] | ] | ||
| }), | }), | ||
| Line 253: | Line 259: | ||
| includePaths: | includePaths: | ||
| path.resolve(' | path.resolve(' | ||
| - | path.resolve(' | + | path.resolve(corePluginBase + 'Scss') |
| ] | ] | ||
| } | } | ||
| Line 262: | 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 307: | 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:// | ||