How to use the node-sass.renderFile function in node-sass

To help you get started, we’ve selected a few node-sass examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HalfdanJ / ofDocGenerator / app.js View on Github external
xml2js = require('xml2js'),
  cheerio = require('cheerio'),
  _ = require('underscore')._;



// Set this to the section you work on to speed up the generation.
// But remember to remove it again! :)
var filterGroup = '';

// Check for sass compatibility (it does not work on Travis-ci)
try {
  var sass = require('node-sass');

  //Create the css file from the scss file in assets
  sass.renderFile({
    file: 'assets/stylesheet.scss',
    outFile: 'output/stylesheet.css',
    error: function(error) {
      console.error(error);
    },
    success: function(){}
  });
} catch(e){
  console.log("Sass not installed, skipping");
  filterGroup = '';
}


var root =  process.argv[2] || "../..";
//var dir = root + "/libs/openFrameworksCompiled/project/doxygen/build/";
var dir = "doxygen_build/";
github julesmoretti / fanscape / middleware.js View on Github external
module.exports    = function(app){

//  sass css generator ==========================================================
  if( process.env.LOCAL ){
    sass.renderFile({
      file: './views/css/style.scss',
      success: function(css) {
        // console.log(css);
        console.log('style.css overwritten');
      },
      error: function(error) {
        console.log(error);
      },
      includePaths: ['views/css'],
      // outputStyle: 'compressed',
      outFile: './views/css/style.css'
    });
  }

//  loading standard middleware =================================================
    app.use(bodyParser.json());
github pixelhandler / ember-off-canvas-components / compile-css.js View on Github external
module.exports = function (env) {
  env = env || 'development';
  var configPath = path.resolve(__dirname, 'config/environment');
  var config = require(configPath)(env);
  var cssFile = 'vendor/' + config.addonPrefix + '.css';
  var vendorFile = path.resolve(__dirname, cssFile);

  sass.renderFile({
    file: path.resolve(__dirname, config.sassMain),
    success: function(/*css*/) {
      console.log('node-sass compiled', vendorFile.split(__dirname)[1]);
    },
    error: function(error) {
      console.error(error);
    },
    includePaths: [ path.resolve(__dirname, config.sassIncludePath) ],
    outputStyle: (env === 'development') ? 'nested' : 'compressed',
    outFile: vendorFile,
    precision: 5,
    sourceMap: (env === 'development')
  });
};