How to use the node-sass.middleware 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 teslajs / tesla.js / config / express.js View on Github external
.set('compress', compress);
      }
    }

    app.use(stylus.middleware({
      src: app.config.root + '/public/',
      compile: compile
    }));


  // CUSTOM SETTINGS FOR SASS
  } else if ( app.config.engines.css === 'sass' && app.config.middleware.css === true ) {

    var sass = require('node-sass');

    app.use(sass.middleware({
      src: app.config.root + '/public/',
      dest: app.config.root + '/public/',
      debug: app.config.prettify.css
    }));

  // CUSTOM SETTINGS FOR LESS
  } else if ( app.config.engines.css === 'less' && app.config.middleware.css === true ) {

    var less = require('less-middleware');

    if ( app.config.prettify.css === true ) {
      compress = false;
    } else {
      compress = true;
    }
github ic4 / drops / app.js View on Github external
var sass = require('node-sass');

var routes = require('./routes/index');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(favicon(__dirname + '/favicon.ico', { maxAge: 8640000000 })); // maxAge = 100 Days
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
app.use(cookieParser());
app.use(sass.middleware({
    outputStyle: 'nested',
    force: true,
    //debug: true,
    src: path.join(__dirname, 'scss'),
    prefix: '/scss'
}));

app.use('/scss', express.static(path.join(__dirname, 'scss')));
app.use('/html', express.static(path.join(__dirname, 'html')));
app.use('/images', express.static(path.join(__dirname, 'images')));

app.use('/', routes);

/// catch 404 and forwarding to error handler
app.use(function(req, res, next) {
    var err = new Error('Not Found');
github saguijs / sagui / Gruntfile.js View on Github external
function sassMiddleware (connect, options) {
  var sass = require('node-sass'),
      middlewares = [],
      sassDest = path.join(__dirname, '/.compiled_sass'),
      directory = options.directory || options.base[options.base.length - 1];

  middlewares.push(sass.middleware({
    src: appRoot,
    includePaths: appRoot,
    dest: sassDest,
    force: true
  }));

  if (!Array.isArray(options.base)) { options.base = [options.base]; }

  options.base.forEach(function(base) { middlewares.push(connect.static(base)); });
  middlewares.push(connect.static(sassDest));
  middlewares.push(connect.directory(directory));

  return middlewares;
}
github afeld / 3d-controller / server / app.js View on Github external
var express = require('express');
var sass = require('node-sass');
var browserify = require('browserify-middleware');

var app = express();

app.use('/browser', browserify('./browser'));

app.use(sass.middleware({
  src: process.cwd() + '/scss',
  dest: process.cwd() + '/css',
  debug: true,
  prefix: '/css'
}));
app.use(express.static(process.cwd()));


module.exports = app;
github stevestreza / DevCenter.me / app.js View on Github external
app.configure(function(){
	app.set('port', process.env.PORT || 4230);
	app.set('views', __dirname + '/views');
	app.set('view engine', 'hbs');
	app.use(express.favicon());
	app.use(express.logger('dev'));
	app.use(express.bodyParser());
	app.use(express.methodOverride());
	app.use(app.router);
	app.use(sass.middleware({
		src:  path.join(__dirname, 'scss'),
		dest: path.join(__dirname, 'public'),
		debug: (process.env.NODE_ENV === "development")
	}));
	app.use(express.static(path.join(__dirname, 'public')));

	app.locals.hostname = process.env.HOSTNAME || 'devcenter.me';
});
github TWtablero / tablero / app.js View on Github external
var sass = require('node-sass');
var path = require('path');
var app = express();
var cookieParser = require('cookie-parser');
var configurable = require('./lib/configurable');
var _ = require('underscore');


var configServer = require('./config/server.js');
var configClient = require('./config/client.js');

var oauthUrl = configServer.oauthUrl;
var clientId = configServer.clientId;
var clientSecret = configServer.clientSecret;

app.use(sass.middleware({
  src: __dirname + '/app',
  debug: false
}));

app.use(express.static(path.join(__dirname, 'app')));

var bodyParser = require('body-parser');
app.use(bodyParser.json());

app.use(cookieParser());

app.get('/config', function(req, res) {
  res.send(configClient);
});

app.get('/request_code', function(req, res) {