brunch / stylus-brunch

Adds Stylus support to Brunch
MIT License
21 stars 2 forks source link

Plugins and config format #54

Closed r3verser closed 7 years ago

r3verser commented 7 years ago

Why on main website configs typed as js objects but here in another format

config =
  plugins:
    stylus:
      plugins: ['my-stylus-plugin']

instead of

  plugins: {
    stylus: {
      includeCss: true,
      plugins: ['my-stylus-plugin']
    }
  }

And second question, what do you mean - stylus plugins

You can include Stylus plugins with a config directive config.plugins.stylus.plugins (array) with paths to require the needed plugins. You will have to include your plugin dependencies in package.json.

Where i can find those middleware plugins, and do i need to install them to get Stylus compiler features work as stated on the official Stylus page? Thanks.

denysdovhan commented 7 years ago

First question:

Why on main website configs typed as js objects but here in another format

Examples in this repo are written in CoffeeScript using coffeescript object literals. For example:

config =
  plugins:
    stylus:
      plugins: ['my-stylus-plugin']

Corresponds to this one written in JavaScript:

var config = {
  plugins: {
    stylus: {
      plugins: ['my-stylus-plugin']
    }
  }
}

Second question:

what do you mean - stylus plugins

Stylus gives us ability to use plugins and extension through JavaScript API. Here are useful gist about Stylus Plugin usage.

The most popular plugins for Stylus is nib. You may find it useful in your development. You can install nib using npm:

$ npm install nib

Take a look in repo nib's for usage examples.

Where i can find those middleware plugins

Unfortunately, I don't know about any existing Stylus Plugin's registry. Maybe someone else can help you here.

do i need to install them to get Stylus compiler features work as stated on the official Stylus page?

Yes, you need to install plugins through npm, but if you're going to use only Stylus' features, stylus package (or stylus-brunch in this case) is enough for you.

r3verser commented 7 years ago

@denysdovhan thank you for the comprehensive answer! :+1: