sass / Node Sass Middleware
Licence: mit
connect middleware extracted from node-sass
Stars: ✭ 247
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Node Sass Middleware
Connext Js
A middleware and route handling solution for Next.js.
Stars: ✭ 211 (-14.57%)
Mutual labels: middleware
Letsencrypt Rails Heroku
Automatic LetsEncrypt SSL certificates in your Rails app on Heroku.
Stars: ✭ 223 (-9.72%)
Mutual labels: middleware
My Review
主要存放平时理论学习,比如java jdk源码分析、并发理论;面试、数据库、Linux、中间件、分布式、网络协议等方向
Stars: ✭ 237 (-4.05%)
Mutual labels: middleware
Caddy Authz
Caddy-authz is a middleware for Caddy that blocks or allows requests based on access control policies.
Stars: ✭ 221 (-10.53%)
Mutual labels: middleware
Mux
A powerful HTTP router and URL matcher for building Go web servers with 🦍
Stars: ✭ 15,667 (+6242.91%)
Mutual labels: middleware
Httpkit
⚡️ High-level, High-performance HTTP(S) Clients/Servers in Reason/OCaml
Stars: ✭ 198 (-19.84%)
Mutual labels: middleware
Jeff
🍍Jeff provides the simplest way to manage web sessions in Go.
Stars: ✭ 223 (-9.72%)
Mutual labels: middleware
Redux Websocket
A Redux middleware to handle WebSocket connections.
Stars: ✭ 232 (-6.07%)
Mutual labels: middleware
Router.cr
Minimum High Performance Middleware for Crystal Web Server.
Stars: ✭ 231 (-6.48%)
Mutual labels: middleware
Iceoryx
iceoryx - true zero-copy inter-process-communication
Stars: ✭ 208 (-15.79%)
Mutual labels: middleware
Express Basic Auth
Plug & play basic auth middleware for express
Stars: ✭ 241 (-2.43%)
Mutual labels: middleware
Slim Session
A very simple session middleware for Slim Framework 2/3/4.
Stars: ✭ 200 (-19.03%)
Mutual labels: middleware
Csaguzzlebundle
A bundle integrating Guzzle >=4.0 in Symfony
Stars: ✭ 248 (+0.4%)
Mutual labels: middleware
Clevergo
👅 CleverGo is a lightweight, feature rich and high performance HTTP router for Go.
Stars: ✭ 246 (-0.4%)
Mutual labels: middleware
Chromelogger Python
Python library for logging variables to Google Chrome console
Stars: ✭ 232 (-6.07%)
Mutual labels: middleware
node-sass-middleware
Connect/Express middleware for node-sass.
Install
npm install node-sass-middleware
Usage
Recompile .scss
or .sass
files automatically for connect and express based http servers.
Connect example
var connect = require('connect')
var sassMiddleware = require('node-sass-middleware')
var server = connect.createServer(
sassMiddleware({
/* Options */
src: __dirname
, dest: __dirname + '/public'
, debug: true
, outputStyle: 'compressed'
, prefix: '/prefix' // Where prefix is at <link rel="stylesheets" href="prefix/style.css"/>
}),
connect.static('/prefix', __dirname + '/public')
);
There is an example connect app here: https://github.com/andrew/node-sass-example
Heavily inspired by https://github.com/LearnBoost/stylus
Express example
var express = require('express');
var sassMiddleware = require('node-sass-middleware');
var path = require('path');
var app = express();
app.use(sassMiddleware({
/* Options */
src: __dirname,
dest: path.join(__dirname, 'public'),
debug: true,
outputStyle: 'compressed',
prefix: '/prefix' // Where prefix is at <link rel="stylesheets" href="prefix/style.css"/>
}));
// Note: you must place sass-middleware *before* `express.static` or else it will
// not work.
app.use('/public', express.static(path.join(__dirname, 'public')));
Connect with other middleware example
var connect = require('connect');
var sassMiddleware = require('node-sass-middleware');
var postcssMiddleware = require('postcss-middleware');
var autoprefixer = require('autoprefixer');
var path = require('path');
var http = require('http');
var app = connect();
var destPath = __dirname + '/public';
app.use(sassMiddleware({
/* Options */
src: __dirname
, response: false
, dest: destPath
, outputStyle: 'extended'
}));
app.use(postcssMiddleware({
plugins: [
/* Plugins */
autoprefixer({
/* Options */
})
],
src: function(req) {
return path.join(destPath, req.url);
}
}));
http.createServer(app).listen(3000);
Options
-
src
- (String) Source directory used to find.scss
or.sass
files.
Optional configurations:
-
beepOnError
- Enable beep on error, false by default. -
debug
-[true | false]
, false by default. Output debugging information. -
dest
- (String) Destination directory used to output.css
files (when undefined defaults tosrc
). -
error
- A function to be called when something goes wrong. -
force
-[true | false]
, false by default. Always re-compile. -
indentedSyntax
-[true | false]
, false by default. If true compiles files with the.sass
extension instead of.scss
in thesrc
directory. -
log
-function(severity, key, val, message)
, used to log data instead of the defaultconsole.error
. "severity" matches Winston severity levels. -
maxAge
- MaxAge to be passed in Cache-Control header. -
prefix
- (String) It will tell the sass middleware that any request file will always be prefixed with<prefix>
and this prefix should be ignored. -
response
-[true | false]
, true by default. To write output directly to response instead of to a file. -
root
- (String) A base path for both source and destination directories.
For full list of options from original node-sass project go here.
Express example with custom log function
var express = require('express');
var sassMiddleware = require('node-sass-middleware');
var path = require('path');
var winston = require('winston');
var app = express();
winston.level = 'debug';
app.use(sassMiddleware({
/* Options */
src: __dirname,
dest: path.join(__dirname, 'public'),
debug: true,
log: function (severity, key, value) { winston.log(severity, 'node-sass-middleware %s : %s', key, value); }
}));
// Note: you must place sass-middleware *before* `express.static` or else it will
// not work.
app.use(express.static(path.join(__dirname, 'public')));
Contributors
We <3 our contributors! A special thanks to all those who have clocked in some dev time on this project, we really appreciate your hard work. You can find a full list of those people here.
Building and Testing
git clone [email protected]:sass/node-sass-middleware
cd node-sass-middleware
npm install
npm test
Note on Patches/Pull Requests
- Fork the project.
- Make your feature addition or bug fix.
- Add documentation if necessary.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Send a pull request. Bonus points for topic branches.
Copyright
Copyright (c) 2013+ Andrew Nesbitt. See LICENSE for details.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].