Recursively import entire directories of stylus files
Clone or download
Pull request Compare This branch is 27 commits ahead, 1 commit behind ixti:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
Gruntfile.coffee
LICENSE
README.md
index.js
package.json

README.md

stylus-import-tree

This plugin allows you to recursively import entire directories instead of writing bunch of @import statements in your stylus file:

import_tree('./foobar')

// insted of:
// @import 'foobar/a'
// @import 'foobar/b'
// @import 'foobar/c/d'

Import order

Files will be imported in alphabetical order based on filename. To import the files in a specific order you can either name them accordingly, use this plugin in conjunction with a build tool such as Grunt, or import them separately:

@import 'variables'
@import 'base'

import_tree('./modules')

Setup

You can setup this plugin using define

Standalone

importTree = require 'stylus-import-tree'

stylus(str)
.define("import_tree", importTree)
.render (err, css) ->
  throw err if err
  console.log css

Grunt

grunt.initConfig
  stylus:
    dist:
      options:
        define:
          import_tree: require 'stylus-import-tree'
      files:
        'tmp/assets/styles/app.css': ['app/styles/app.styl']

Credit

This is a fork of Style import_tree Proof of Concept by Aleksey V. Zapparov.

License

MIT