Daimz
Daimz

Reputation: 3281

How to a include Stylus Libraries with grunt-contrib-stylus?

How to a include Stylus Libraries with grunt-contrib-stylus?

I would like to add Jeet & Rupture to my stylus setup.

I have run npm install --save-dev rupture & npm install --save-dev jeet

But I am not sure on how to have them used by the stylus setup, this is what I have:

// Compiles Stylus to CSS
    stylus: {
      server: {
        options: {
          paths: [
            '<%= yeoman.client %>/bower_components',
            '<%= yeoman.client %>/app',
            '<%= yeoman.client %>/components',
            '<%= yeoman.client %>/assets'
          ],
          "include css": true
        },
        files: {
          '.tmp/app/app.css' : '<%= yeoman.client %>/app/app.styl'
        }
      }
    },

And this is how I am calling Jeet.

@import 'jeet';

But I get this error failed to locate @import file jeet.styl

>>     6| @import 'jeet';
>> --------------^

Upvotes: 2

Views: 1184

Answers (2)

Daimz
Daimz

Reputation: 3281

For those that are interested I have found a solution:

stylus: {
      server: {
        options: {
          use: [
            require('jeet'),
            require('rupture'),
            function() { return require('autoprefixer-stylus')('last 2 versions', 'ie 8'); }
          ],
          paths: [
            './node_modules/rupture',
            './node_modules/jeet/stylus',
            '<%= yeoman.client %>/bower_components',
            '<%= yeoman.client %>/app',
            '<%= yeoman.client %>/components',
            '<%= yeoman.client %>/assets'
          ],
          // "include css": true,
          // use: jeet()
        },
        files: {
          '.tmp/app/app.css' : '<%= yeoman.client %>/app/app.styl'
        }
      }
    },

Upvotes: 2

user2033464
user2033464

Reputation: 143

An alternative solution would be to include a full path to the library, eg.

@import '/bower_components/jeet/stylus/jeet' 

You can do this for all your required libraries.

Upvotes: 1

Related Questions