Single-file-output cssnext compiler for Broccoli

Usage no npm install needed!

<script type="module">
  import broccoliCssnextSingle from '';



npm Version Build Status

The broccoli-cssnext-single plugin compiles .css files with cssnext.

This plugin is designed to compile a single, primary input file into a single output file, with a tree of @importd dependencies. This differs from broccoli-cssnext, which compiles each .css file individually into a .css file and doesn't support @imports or a single output file depending on multiple inputs.

This code is based heavily on broccoli-less-single


npm install --save-dev broccoli-cssnext-single


var compileCssnext = require('broccoli-cssnext-single');

var outputTree = compileCssnext(inputTrees, inputFile, outputFile, options)
  • inputTrees: An array of trees that act as the include paths for cssnext. If you have a single tree, pass [tree].

  • inputFile: Relative path of the main .css file to compile. This file must exist in one of the inputTrees.

  • outputFile: Relative path of the output CSS file.

  • options: A hash of options for cssnext.


var appCss = compileCssnext(sourceTrees, 'myapp/app.css', 'assets/app.css')


/* file: sub.css */
h1 {
  font-size: 200em;

/* =================== */

/* file: app.css */
@import "sub";

html, body {
  margin: 20px;