RequireJS Stylus loader module.
- compile *.styl files on-the-fly
- insert compiled CSS into
<head>
- optimize support (resulting CSS will be compiled into resulting javascript)
Development works on all major browsers. IE7+ works after optimize.
bower install require-stylus
require.config({
"map": {
"*": {
"styl": "components/require-stylus/require-stylus", // RequireJS loader plugin
"stylus": "components/require-stylus/stylus" // client-side stylus compiler instance (can/should be substituted with actual required stylus version)
}
}
});
require(['styl!path/to/styles']); // path/to/styles.styl
Example Gruntfile.coffee:
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
requirejs:
compile:
options:
baseUrl: "."
include: "main.js"
out: "main.min.js"
stubModules: [ 'styl' ]
exclude: [ 'stylus' ]
paths:
"styl": "components/require-stylus/require-stylus",
"stylus": "components/require-stylus/stylus",
grunt.loadNpmTasks 'grunt-contrib-requirejs'
grunt.registerTask 'default', ['requirejs']
- @import support for stylus
Anything you wish:
- MIT (just free)
- JSON (use for Good, not Evil)
- AYFL (Any Yourself Fucking License)