Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
sass-dev-server
Advanced tools
a dev server that compile your sass files on demand, no watcher, no configuration required
is a dev server that compile your sass files on demand, no watcher, no configuration required.
Note: For development only, do not use in production!
@import
directive:
@import "components/*.scss"
@import "css:components/box.css"
@import "npm:bourbon/app/assets/stylesheets/_bourbon.scss";
express
app and build toolsnpm install -g sass-dev-server
Usage: sass-dev-server [options]
Options:
-h, --help output usage information
-V, --version output the version number
-p, --port [port] port number that server listen to
-r, --root [root] server's root directory
-g, --get [path] make a GET request to a path
Providing this is your project folder structure
myproject
├── assets
| └── styles
| └── main.scss
sass-dev-server
inside myproject
$ myproject> sass-dev-server
> Running sass-dev-server at http://localhost:9000 with root set to "./"
<link rel="stylesheet" type="text/css" href="http://localhost:9000/assets/styles/main.scss">
Additionally, you can add an optional --root
argument
$ myproject> sass-dev-server --root=assets/
> Running sass-dev-server at http://localhost:9000 with root set to "assets/"
That would make the server root to be at myproject/assets
, thus your stylesheet path is shorten (without assets/
)
<link rel="stylesheet" type="text/css" href="http://localhost:9000/styles/main.scss">
sass-dev-server -g assets/styles/main.scss > assets/compiled/main.css
var Compiler = require('sass-dev-server').Compiler,
Server = require('sass-dev-server').Server,
express = require('express');
// create / setup your own express app
var app = express();
...
// integrate sass-dev-server with your express app
var compiler = new Compiler();
var server = new Server(compiler);
server.use(app);
...
app.listen(3000);
var render = require('sass-dev-server').render;
// path is relative to `process.cwd()`, and server root
var file = 'assets/styles/main.scss';
var out = 'assets/compiled/main.css';
render(file, out).then(function(path) {
console.log('rendered to %s', path);
});
If you want to customise how server is running and / or how sass
files are compiled, create a sass-dev-server.config.js
in the same folder where you are running sass-dev-server
// sass-dev-server.config.js
module.exports = {
server: {
root: "assets/"
port: 10000,
headers: {
...
}
},
compiler: {
// all node-sass options
...
}
}
sass-dev-server
comes with a flexible custom importer, there are a few things you can do
@import "components/*.scss"
css:
prefix@import "css:components/box.css"
npm:
prefix@import "npm:bourbon/app/assets/stylesheets/_bourbon.scss";
.local
domain if you are on Mac instead of localhost
, that will ensure that your stylesheet still working when other machines are viewing the site--root
parameter, take into account of other things that being referenced inside the stylesheet file, e.g images, fontsFAQs
a dev server that compile your sass files on demand, no watcher, no configuration required
We found that sass-dev-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.