A custom Meteor build plugin for compiling Stylus (.styl
) files into CSS, automatically adding vendor prefixes with Autoprefixer, and supporting Hot Module Replacement (HMR) for an enhanced development experience.
To add the plugin to your Meteor project, use the following command:
meteor add chatra:stylus-autoprefixer
Ensure that the standard-minifier-css
package is installed to handle CSS minification in production:
meteor add standard-minifier-css
Once installed, the plugin automatically processes all .styl
files in your Meteor project. No additional configuration is required for basic usage.
For advanced configurations, you can create a stylus.config.js
file in the root of your Meteor project. This file allows you to customize paths, global imports, and additional Stylus compilation options.
const path = require('path');
module.exports = {
// Paths to search for files when using @import
includePaths: [
path.join(process.cwd(), 'client/styles/stylus/'),
path.join(process.cwd(), 'shared/styles/'),
],
// Files to automatically import in every Stylus file
importFiles: ['vars', 'mixins'],
// Additional Stylus compilation options
stylusOptions: {
'include css': true, // Allow importing plain CSS files
},
};
This package is licensed under the MIT License.