Giter VIP home page Giter VIP logo

inline-scss-brunch's Introduction

inline-css-brunch

This is fork of https://github.com/colinbate/inline-css-brunch.

Brunch plugin to read your SCSS files, compile to CSS and stores as strings in JS. This is useful for frameworks like Angular 2 so you don't need to make separate requests for styles.

Requires Brunch 2.6 or later and node-sass.

Install

npm install -D inline-scss-brunch

Configuration

You can configure where the plugin is used.

exports.config = {
  plugins: {
    inlineScss: {
      passthrough: /^(node_modules)|(app\/styles)/,
      options: {
        outputStyle: 'nested'
      }
    }
  }
}

pattern

Similar to other plugins, this defines which files Brunch will send to this plugin. If you want it to only handle SCSS files from a particular part of your app, this will do it. This value can be a string with wildcards or a RegExp or any array of those things.

passthrough

By default this plugin will create wrapped JS modules out of your CSS strings, however, if you want some of your CSS files to be sent to the stylesheets output, you can do that with this option.

Anything matching this string/RegExp/array will not be wrapped as a JS module, but instead added to the output stylesheets.

By default, this plugin will passthrough anything in the node_modules folder. This allows it to be used with the npm.styles config option.

If you don't want anything to passthrough, you can pass false for this option. However, npm.styles will not work in that case.

This behaviour means you don't need to include css-brunch in addition to this one. Unless you want the CSS modules.

options

Options to pass for node-sass directly.

Usage

const myCssString = require('./my-css-file.scss');

If you have JS/TS files with the same base name as your SCSS files, and you want to refer to those files without their extension, you will probably need to include this in your config file:

exports.config = {
  files: {
    javascripts: {
      order: {
        after: [/\.scss$/]
      }
    }
  }
}

This will force your CSS files to be output later in the file, which means they won't take the alias for the base name.

inline-scss-brunch's People

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.