Skip to content

Use less to preprocess your ember-cli app's css.

Notifications You must be signed in to change notification settings

kwikPRs/ember-cli-less

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ember-cli-less

Use Less to preprocess your ember-cli app's css.

Installation

npm install --save-dev ember-cli-less

Usage

By default, this addon will compile app/styles/app.less into dist/assets/app.css.
Additional options can be specified using the lessOptions config property in ember-cli-build.js:

var app = new EmberApp({
  lessOptions: {...}
});

Available Options:

Configuring Input/Output Paths

You can configure the input and output files using ember-cli's outputPaths option in ember-cli-build.js:

var app = new EmberApp({
  outputPaths: {
    app: {
      css: {
        'app': '/assets/my-project.css'
      }
    }
  }
});

You can also configure multiple input/output paths to generate multiple css files:

var app = new EmberApp({
  outputPaths: {
    app: {
      css: {
        'theme-orange': '/assets/theme-orange.css',
        'theme-purple': '/assets/theme-purple.css'
      }
    }
  }
});

Usage in Addons

You can also use this to precompile less files in an addon. By default, this will compile addon/styles/addon.less into css that will be merged into the host app's css. (requires ember-cli >= 0.2.0):

  1. Install ember-cli-less in your addon's package.json under dependencies
  2. Create your addon less file at addon/styles/addon.less (or where you specify in your options)
  3. To run the addon's dummy app, be sure to create tests/dummy/app/styles/app.less if it doesn't exist

Examples

Using Bootstrap Less source in your app:

Install Bootstrap source:

bower install --S bootstrap

Specify the include paths in ember-cli-build.js:

var app = new EmberApp({
  lessOptions: {
    paths: [
      'bower_components/bootstrap/less'
    ]
  }
});

Import into app.less:

@import 'bootstrap';

Linking source maps

When sourcemaps are enabled, you'll see the correct references to the original less files and their corresponding line numbers in Dev Tools. If you would like to link the less source files directly, you have to link them to your local filesystem in Chrome:

  1. Open dev tools > Sources tab
  2. Expand the sources pane on the left if it's not open
  3. Right-click anywhere, Add folder to workspace, add your project's folder
  4. Locate any less source file in the tree, right-click, Map to Network Resource... to create the mapping

References

About

Use less to preprocess your ember-cli app's css.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%