Open LucioFranco opened 8 years ago
I think the job of running tasks on assets built by cobalt is best left to existing tools, like Gulp
, Webpack
, or Grunt
-- but maybe cobalt build
can be refactored to call a post-build command if provided and the build is successful? E.g.:
$ cobalt build --after-success="./node_modules/.bin/gulp minify"
> [info] Using config file .cobalt.yml
> [info] Building from . into build
> [info] Created build\posts\post-1.html
> [info] Created build\index.html
> [info] Copying remaining assets
> [info] Build successful
> [info] Executing after-success hook: "./node_modules/.bin/gulp minify"
Note that cobalt serve
and cobalt watch
should also accept this option. Perhaps it should be defined in the configuration file instead of as a CLI option?
See https://github.com/cobalt-org/cobalt.rs/pull/135 for more discussion around pre/post-processing of files.
I think it would be cool to have another program deal with all of the minification or compilation of sass or liquid. We could either create it internally to cobalt or a separate program. The asset manager would have a trait that each preprocessor/plugin would need to implement.