Process your Wintersmith site with Gulp plugins.
vinylsmith = require 'vinylsmith'stylus = require 'gulp-stylus'pleeease = require 'gulp-pleeease'rev = require 'gulp-rev'# In your custom plugin (see Usage for more details):# Instead of writing your own ContentPlugin, use vinylsmith to generate them!envregisterContentPlugin 'styles''**/*.styl'vinylsmithenvpipestylus'include css': true # compile styluspipepleeease # autoprefix, minifypiperev # asset-hashing
This means you canâ€™t create plugins that do one thing, and one thing well. Instead, you have plugins that do several things, such as wintersmith-autoprefixer-sass and wintersmith-autoprefixer-less. Now I use Stylus and where is wintersmith-autoprefixer-stylus? No. You only have wintersmith-stylus.
Building web sites nowadays requires you to preprocess, compile, and postprocess your assets. Because of different needs and use cases, the combinations are infinite. We wonâ€™t get very far without composability. And hence, vinylsmith!
npm install --save-dev vinylsmith
Create a Wintersmith plugin:
vinylsmith in your plugin:
vinylsmith = require 'vinylsmith'stylus = require 'gulp-stylus'pleeease = require 'gulp-pleeease'babel = require 'gulp-babel'uglify = require 'gulp-uglify'rev = require 'gulp-rev'=envregisterContentPlugin 'styles''**/*.styl'vinylsmithenvpipestylus'include css': truepipepleeeasepiperevenvregisterContentPlugin 'scripts''**/*.js'vinylsmithenvpipebabelexperimental: truepipeuglifypiperevcallback
Note: Don't call the plugin function! vinylsmith will call it for you. See also: lazypipe.
Note: Your Gulp plugin pipeline must emit only one file! This is by design, because Wintersmith assumes 1-to-1 mapping from content files to output files.
- I wrote and maintain this package for use in my own projects.
- Therefore, if you find issues with this package, please donâ€™t expect me to fix it. This packageâ€™s code is less than 100 lines, and you are encouraged to fix it. Pull requests are welcome.
- There are no tests, but it worked pretty well for my project. If you feel the need for one, feel free to write one! Again, pull requests are welcome. 😃