Coder Social home page Coder Social logo

ember-stylus's Introduction

ember-stylus

ember-stylus uses broccoli-stylus-single to preprocess your ember-cli app's files and provides support for source maps and include paths. It provides support for the common use case for Ember.js projects:

Installation

ember install ember-stylus

Addon Development

If you want to use ember-stylus in an addon and you want to distribute the compiled CSS it must be installed as a dependency so that addon/styles/addon.styl is compiled into dist/assets/vendor.css. This can be done using:

npm install --save ember-stylus

Usage

By default this addon will compile app/styles/app.styl into dist/assets/[app-name].css and produce a source map for your delectation.

If you want more control then you can specify options using the stylusOptions config property in ember-cli-build.js (or in Brocfile.js if you are using an Ember CLI version older than 1.13):

var app = new EmberApp({
  stylusOptions: {...}
});
  • includePaths: an array of include paths
  • sourceMap: controls whether to generate sourceMaps, defaults to true in development. The sourceMap file will be saved to options.outputFile + '.map'

Processing multiple files

If you need to process multiple files, it can be done by configuring the output paths in your ember-cli-build.js:

var app = new EmberApp({
  outputPaths: {
    app: {
      css: {
        'app': '/assets/application-name.css',
        'themes/alpha': '/assets/themes/alpha.css'
      }
    }
  }
});

Example

The following example assumes your bower packages are installed into node_modules/.

Install some Stylus:

npm install --save-dev kouto-swiss

Specify some include paths in your ember-cli-build.js:

var app = new EmberApp({
  stylusOptions: {
    includePaths: [
      'node_modules/kouto-swiss'
    ]
  }
});

Import some deps into your app.scss:

@import 'kouto-swiss'; /* import everything */
/* or just import the bits you need: @import 'kouto-swiss/functions'; */

Addon Usage

To compile Stylus within an ember-cli addon, there are a few additional steps:

  1. Include your styles in addon/styles/addon.styl.

  2. Ensure you've installed ember-stylus under dependencies in your package.json.

  3. Define an included function in your app:

    // in your index.js
    module.exports = {
      name: 'my-addon',
      included: function(app) {
        this._super.included(app);
      }
    };
  4. Make sure your dummy app contains an app.scss

  5. If you run ember build dist, your styles from addon/styles/addon.styl should appear correctly in dist/assets/vendor.css

For an example of an addon that does this correctly, see ember-cli-notifications

ember-stylus's People

Contributors

ahoyahoy avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-stylus's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.