Open chrisdmacrae opened 6 years ago
Imagemin CLI is a no-go because it doesn't honor directory structure. imagemin-power-cli
looks promising, and can just be dropped in.
Webpack config is almost ready, but something is wrong w/ entry point resolution... would love to get your eyes on this @ncphillips
@budparr added PurgeCSS to C-S-S; it only runs for production builds, and reads all of the .html
files in the dist/
directory and the .css
files in the static css/
directory to purge the css.
Note to self: the CLI still isn't working in the task executor but can confirm the config works when running manually. Just need to figure what's up with the process spawning.
@chrisdmacrae I imagine you have to use the output HTML because you can't assume too much about your layouts, but fwiw, I run Purge against my layouts: https://github.com/theNewDynamic/hugo-starter/blob/master/webpack.prod.js#L74
And I split my Webpack into dev/prod/common yesterday and it is a breath of fresh air!
@budparr You're 100% correct there -- people could be abstracting their classes into variables for all I know, so I need valid, distributable HTML to validate against.
So, @chrisdmacrae what does that do to performance? It's not hard to have a site with several thousand pages.
@budparr I'm not too worried about it; PurgeCSS isn't really doing an expensive operation; it's just grabbing text and splitting it into an array by spaces.
Something that's worth testing, though.
@ncphillips I need a second set of eyes on webpack.config.dev.js
and webpack.config.prod.js
.
It's using the bulk of CRA's stuff, heavily commented. But it doesn't seem to like the entryPoint resolved from paths.js
.
I can hardcode it and it will work.
@chrisdmacrae just pulled down this branch. I'll get back to you shortly.
@chrisdmacrae I'm hitting some issues with this branch. When I run yarn start
I get some errors:
8 Mar 18:10:46 - [ImageMin] /bin/sh: chokidar: command not found
8 Mar 18:10:46 -
8 Mar 18:10:47 - [SVG Sprite] /bin/sh: src/img/svg/bitbucket.svg: Permission denied
8 Mar 18:10:47 -
8 Mar 18:10:48 - [Webpack] Webpack Dev Entry /Users/nolan/Code/forestryio/create-static-site/demo1/src/js
8 Mar 18:10:48 -
8 Mar 18:10:48 - [Webpack]
8 Mar 18:10:48 - Webpack is watching the files…
8 Mar 18:10:48 -
8 Mar 18:10:48 -
8 Mar 18:10:48 - [Webpack] (node:27032) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
8 Mar 18:10:48 -
8 Mar 18:10:48 - [Webpack] /Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/react-dev-utils/WatchMissingNodeModulesPlugin.js:25
8 Mar 18:10:48 - if (missingDeps.some(file => file.indexOf(nodeModulesPath) !== -1)) {
8 Mar 18:10:48 - ^
8 Mar 18:10:48 -
8 Mar 18:10:48 - TypeError: missingDeps.some is not a function
8 Mar 18:10:48 - at compiler.plugin (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/react-dev-utils/WatchMissingNodeModulesPlugin.js:25:23)
8 Mar 18:10:48 - at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:7:1)
8 Mar 18:10:48 - at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/tapable/lib/Hook.js:35:21)
8 Mar 18:10:48 - at Compiler.emitAssets (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/webpack/lib/Compiler.js:287:19)
8 Mar 18:10:48 - at onCompiled (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/webpack/lib/Watching.js:50:19)
8 Mar 18:10:48 - at hooks.afterCompile.callAsync.err (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/webpack/lib/Compiler.js:470:14)
8 Mar 18:10:48 - at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:15:1)
8 Mar 18:10:48 - at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/tapable/lib/Hook.js:35:21)
8 Mar 18:10:48 - at compilation.seal.err (/Users/nolan/Code/forestryio/create-static-site/demo1/node_modules/webpack/lib/Compiler.js:467:30)
Submitting this PR to track the progress of this refactor
Tasks*
[x] Remove gulp
[x] Create a task pipeline
[x] Setup PostCSS
[x] Setup webpack
[ ] Setup Purge CSS
[x] Setup Imagemin
imagemin-cli
)~imagemin-power-cli
)[x] Setup SVG Sprite
[x] Setup Generic Generator Command
[x] Setup Project cascade
static-scripts.config.js
None of these tasks can be confirmed until they've been tested or have tests written for them.