GithubHelp home page GithubHelp logo

devinchen / node-sass-import-once Goto Github PK

View Code? Open in Web Editor NEW

This project forked from at-import/node-sass-import-once

0.0 2.0 0.0 159 KB

Eyeglass style Import Once, but for all the things!

License: Other

JavaScript 10.34% CSS 89.66%

node-sass-import-once's Introduction

Import Once npm version Build Status

General import-once importer for node-sass inspired by Eyeglass.

Installation

$ npm install node-sass-import-once --save-dev

Requires Node Sass >= v3.0.0-alpha.5

Usage

var sass = require('node-sass');,
    importOnce = require('node-sass-import-once');

sass.render({
  file: scss_filename,
  importer: importOnce,
  importOnce: {
    index: false,
    css: false,
    bower: false
  }
});

If you are using Gulp or Grunt to compile (or similiar), require node-sass-import-once as normal and pass it as the importer option in to your task.

Features

Node Sass Import Once will ensure that each file import is only imported once. In addition to that, the following options are available:

  • index - Allows folders to contain an index file (index.scss, index.sass, _index.scss, _index.sass) that will automatically be imported if just the folder name is imported. For instance, @import 'partials'; will try and import (_)partials.s(c|a)ss first, then partials/(_)index.s(c|a)ss.
  • css - Allows a CSS file to be imported directly into your Sass files. Simply don't include a file extension, and if it's available as a CSS file it'll be imported!
  • bower - Automatically parses your Bower directory for the files you're requested. Will look for the file in bower_components (or specified directory from .bowerrc), bower_components/{module-name}/stylesheets, bower_components/{module-name}-sass/stylesheets, bower_components/sass-{module-name}/stylesheets, bower_components/{module-name}/sass, bower_components/{module-name}-sass/sass, bower_components/sass-{module-name}/sass. {module-name} is the first section of your import path, so in @import 'breakpoint' breakpoint would be your module name and in @import 'toolkit/kickstart toolkit would be your module name. If you also have css enabled, it will look inside of bower_components/{module-name}/dist and bower_components/{module-name}/dist/css.

If you import a file ending in .js, .json, .yml, or .yaml, the importer will attempt to transform your JSON or YAML into a Sass map, with the variable name being the name of the file.

node-sass-import-once's People

Contributors

devinchen avatar snugug avatar

Watchers

 avatar  avatar

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.