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.