forestryio / create-static-site

Create static websites with no build configuration.
MIT License
135 stars 10 forks source link

[In progress] Remove gulp & refactor core API #37

Open chrisdmacrae opened 6 years ago

chrisdmacrae commented 6 years ago

Submitting this PR to track the progress of this refactor

Tasks*

chrisdmacrae commented 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.

chrisdmacrae commented 6 years ago

Webpack config is almost ready, but something is wrong w/ entry point resolution... would love to get your eyes on this @ncphillips

chrisdmacrae commented 6 years ago

@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.

budparr commented 6 years ago

@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!

chrisdmacrae commented 6 years ago

@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.

budparr commented 6 years ago

So, @chrisdmacrae what does that do to performance? It's not hard to have a site with several thousand pages.

chrisdmacrae commented 6 years ago

@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.

chrisdmacrae commented 6 years ago

@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.

ncphillips commented 6 years ago

@chrisdmacrae just pulled down this branch. I'll get back to you shortly.

ncphillips commented 6 years ago

@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)