Skip to content

Conversation

chrisdmacrae
Copy link
Contributor

@chrisdmacrae chrisdmacrae commented Mar 1, 2018

Submitting this PR to track the progress of this refactor

Tasks*

  • Remove gulp
  • Create a task pipeline
  • Setup PostCSS
    • Raw CLI input
    • Webpack
  • Setup webpack
    • Raw CLI
  • Setup Purge CSS
    • Raw CLI input
    • Webpack
  • Setup Imagemin
    • Raw CLI input (imagemin-cli)
    • Raw CLI input (imagemin-power-cli)
  • Setup SVG Sprite
    • Raw CLI input
  • Setup Generic Generator Command
    • Raw CLI input
  • Setup Project cascade
    • Ensure all config options inherit from project's static-scripts.config.js
  • None of these tasks can be confirmed until they've been tested or have tests written for them.

@chrisdmacrae
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@chrisdmacrae
Copy link
Contributor Author

chrisdmacrae commented Mar 1, 2018

@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
Copy link

budparr commented Mar 1, 2018

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

spawn.sync(...scriptCmd, { stdio: "inherit" })
// Here we define the tasks using orchestrator,
// an extremely lightweight and efficient task executor
const taskMgr = new Orchestrator();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little nervous about orchestrator because doesn't seem to be maintained. There hasn't been an update in over a year.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't too worried because TBH Gulp is in the same boat. Everyone uses 3.x because 4.0 has been stale for over a year as well.

People submit PRs if there's a bug and somebody will merge them, but it isn't being improved actively.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought is that orchestrator is fine for now. We'll consider alternatives if it becomes an issue. That's the beauty of the build process not being API facing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly! 👯‍♂️

@chrisdmacrae
Copy link
Contributor Author

@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
Copy link

budparr commented Mar 5, 2018

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

@chrisdmacrae
Copy link
Contributor Author

@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
Copy link
Contributor Author

@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
Copy link
Contributor

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

@ncphillips
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants