Git Product home page Git Product logo

node-sass-middleware's People

Contributors

0xdw avatar a-312 avatar am11 avatar amsul avatar andrew avatar arcanoxdragon avatar bryant1410 avatar bumxu avatar danawoodman avatar dependabot[bot] avatar edwellbrook avatar fmmsilva avatar geoffreyplitt avatar hibiyasleep avatar ilanbiala avatar iwaldman avatar jacekkopecky avatar jerone avatar keithamus avatar kevva avatar lightchpa avatar medimatrix avatar nschonni avatar paucodina avatar phillipj avatar robertfall avatar simonkberg avatar teodragovic avatar torfsen avatar xiphe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-sass-middleware's Issues

Warn users that serve static must be after sass middleware

If you load the express.static middleware before node-sass-middleware, the middleware doesn't work. It must be loaded before serving static files.

In other words, this fails:

app.use(express.static(config.PUBLIC_PATH, { index: false }))
app.use(sassMiddleware({
  src: path.join(__dirname, 'styles'),
  dest: config.PUBLIC_PATH,
}))

But this works:

app.use(sassMiddleware({
  src: path.join(__dirname, 'styles'),
  dest: config.PUBLIC_PATH,
}))
app.use(express.static(config.PUBLIC_PATH, { index: false }))

Unable to postprocess compiled css

I want to use another middleware (autoprefixer) to process the compiled css generated by this middleware.

unfortunately this is currently not possible

I identified two problems, causing this to be impossible:

im working on a pr to fix this.

0.9.5 fails due to undefined sassPath (and cssPath)

express.js server error

$ DEBUG=myapp npm start

> [email protected] start /home/me/myapp
> node ./bin/www

  read: undefined
GET / 500 489.753 ms - 1119
Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11)
    at ServerResponse.header (/home/me/myapp/node_modules/express/lib/response.js:718:10)
    at ServerResponse.send (/home/me/myapp/node_modules/express/lib/response.js:163:12)
    at done (/home/me/myapp/node_modules/express/lib/response.js:957:10)
    at Object.exports.renderFile (/home/me/myapp/node_modules/jade/lib/index.js:374:12)
    at View.exports.__express [as engine] (/home/me/myapp/node_modules/jade/lib/index.js:417:11)
    at View.render (/home/me/myapp/node_modules/express/lib/view.js:126:8)
    at tryRender (/home/me/myapp/node_modules/express/lib/application.js:639:10)
    at EventEmitter.render (/home/me/myapp/node_modules/express/lib/application.js:591:3)
    at ServerResponse.render (/home/me/myapp/node_modules/express/lib/response.js:961:7)

express.js client error

TypeError: path must be a string
    at TypeError (native)
    at Object.fs.exists (fs.js:210:11)
    at compile (/home/me/myapp/node_modules/node-sass-middleware/middleware.js:223:10)
    at sass (/home/me/myapp/node_modules/node-sass-middleware/middleware.js:248:14)
    at Layer.handle [as handle_request] (/home/me/myapp/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/me/myapp/node_modules/express/lib/router/index.js:312:13)
    at /home/me/myapp/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/home/me/myapp/node_modules/express/lib/router/index.js:330:12)
    at next (/home/me/myapp/node_modules/express/lib/router/index.js:271:10)
    at cookieParser (/home/me/myapp/node_modules/cookie-parser/index.js:48:5)

Sass files not recompiling

I am using nodemon to detect sass changes and restart the server, however, I have had to add extra functionality so that the server deletes the compiled css files in order that node-sass-middleware can compile them. If I leave the css files undeleted, they will not be updated. This is not a great workflow and ideally sass-middleware will just update the pre-existing css files.

My sass content is very simple, no special circumstances to report.

Getting 404 while installing package

Hello.

I'm trying to use node-sass-middleware in my new generated project (From WebStorm IDE) and I'm getting a 404 error on this package.
I even tried to install it manually but I got the same 404 error.

The error I'm getting is attached in the following pic:
image

How can I install this package?

Missing option in readme

The option outputStyle is missing from the readme config section. I cannot find what the two variations shown in the examples do

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.

Just upgraded to Node 8. When my project attempts to run

app.use(require('node-sass-middleware')({
  src: path.join(__dirname, 'public'),
  dest: path.join(__dirname, 'public'),
  indentedSyntax: true,
  sourceMap: true
}))

it craps out with:

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::V8::ToLocalEmpty() [/usr/local/bin/node]
 4: node::inspector::(anonymous namespace)::CallAndPauseOnStart(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 5: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
 6: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 7: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 8: 0x1cc6388437d
 9: 0x1cc63a50969
10: 0x1cc63a4a823

Extracted from node-sass

Why was this package extracted from the original node-sass package? Isn't this going to add dependencies to people's projects and stagnate development of the middleware.

@import not working

I tried to use @import from my main.scss file and this is not working and it wont show an error on my console and the page would just keep loading.

app.use(sassMiddleware({
  src: __dirname + '/sass',
  dest: __dirname + '/public/css' ,
  prefix: '/css',
  debug: true
}));

Phonegap

How do we use it insde an phonegap app? i was thinking if we make small node app which will only run sass-middleware that will generate index.css but it's not working. Do we have something like generate code each 1 second or do we have other way to do this?

RangeError: Invalid status code: 1

This piece of code

app.use(sassMiddleware({
  src: path.join(__dirname, 'public'),
  dest: path.join(__dirname, 'public'),
  indentedSyntax: true, // true = .sass and false = .scss
  sourceMap: true
}));

is causing the following error:

RangeError: Invalid status code: 1
    at ServerResponse.writeHead (_http_server.js:195:11)
    at ServerResponse.writeHead (/Users/raigovind93/LPN-Fitness-App/node_modules/on-headers/index.js:55:19)
    at ServerResponse.writeHead (/Users/raigovind93/LPN-Fitness-App/node_modules/on-headers/index.js:55:19)
    at ServerResponse._implicitHeader (_http_server.js:159:8)
    at ServerResponse.end (_http_outgoing.js:621:10)
    at ServerResponse.end (/Users/raigovind93/LPN-Fitness-App/node_modules/express-session/index.js:354:19)
    at ServerResponse.send (/Users/raigovind93/LPN-Fitness-App/node_modules/express/lib/response.js:211:10)
    at done (/Users/raigovind93/LPN-Fitness-App/node_modules/express/lib/response.js:967:10)
    at Object.exports.renderFile (/Users/raigovind93/LPN-Fitness-App/node_modules/pug/lib/index.js:422:12)
    at View.exports.__express [as engine] (/Users/raigovind93/LPN-Fitness-App/node_modules/pug/lib/index.js:465:11)
    at View.render (/Users/raigovind93/LPN-Fitness-App/node_modules/express/lib/view.js:128:8)
    at tryRender (/Users/raigovind93/LPN-Fitness-App/node_modules/express/lib/application.js:640:10)
    at Function.render (/Users/raigovind93/LPN-Fitness-App/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/Users/raigovind93/LPN-Fitness-App/node_modules/express/lib/response.js:971:7)
    at /Users/raigovind93/LPN-Fitness-App/app.js:97:7
    at Layer.handle_error (/Users/raigovind93/LPN-Fitness-App/node_modules/express/lib/router/layer.js:71:5)

Could this be because the build is failing?

Here is my dependency in my package.json:

...
    "node-sass-middleware": "^0.9.8"
...

Trouble with source/dest/prefix configuration

I have used node-sass-middleware successfully in the past with a different folder structure, but I am unable to get it working with this one:

My file structure:

public/
    ├───assets/
    │    ├───styles/
scss/
views/
app.js

My middleware configuration:

app .use(
    sass({
      src: path.join(__dirname, 'scss/'),
      dest: path.join(__dirname, 'public/assets/styles/'),
      debug: true,
      outputStyle: 'compressed',
      prefix: 'assets/styles/'
    })
);

My jade view file:

html(lang='en')
  head
    link(rel='stylesheet', href='assets/styles/main.css')

Clearly I am missing something with the prefix field, because I am getting this in my debugging:

source: /project/scss/assets/styles/main.scss
dest: /project/public/assets/styles/assets/styles/main.css
read: /project/public/assets/styles/assets/styles/main.css

Note, I was able to compile the CSS when I removed the prefix field, and had link(rel='stylesheet', href='main.css') in my .jade file. The CSS was generated in the correct dest from the correct src folder, but then there wasn't actually a reference to the CSS from the jade file.

Any help appreciated!

Timeouts upon multiple requests

I'm on [email protected] and when more than three simultaneous requests are made a timeout occurs on all css files and every request after that until I start the server over. Right now I'm using connect package to use the middleware with. I've been able to reproduce the issue by refreshing a single css file multiple times quickly. When I run it with debug the source, dest and read outputs show up but no response.

I was going to try out the middleware with express but the connect and express examples are not up to date with the current version of connect and express.

crashes because of extra indent

Whenever I add an extra indent to my sass code it crashes.
Example code which causes a crash:

.information
    list-style-type: none
        .icon
            height: 20px

Error log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\mediabites\node_modules\.bin;C:\Users\Administrator\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Administrator\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\Program Files\MongoDB\Server\3.2\bin;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Local\atom\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle [email protected]~start: CWD: D:\mediabites
11 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'node ./bin/www' ]
12 silly lifecycle [email protected]~start: Returned: code: 3221225477  signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `node ./bin/www`
14 verbose stack Exit status 3221225477
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:232:16)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at EventEmitter.emit (events.js:185:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at ChildProcess.emit (events.js:185:7)
14 verbose stack     at maybeClose (internal/child_process.js:821:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid [email protected]
16 verbose cwd D:\mediabites
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v5.5.0
20 error npm  v3.3.12
21 error code ELIFECYCLE
22 error [email protected] start: `node ./bin/www`
22 error Exit status 3221225477
23 error Failed at the [email protected] start script 'node ./bin/www'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the mediabites package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     node ./bin/www
23 error You can get their info via:
23 error     npm owner ls mediabites
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Not possible to add headers to the response

The compile function calls httpResponse.end() making it impossible to further process the response. There should be an option to allow further processing.

In my case, I would like to add a Content-length header to the response.

Caching ?

Just wondering what sort of cache handling is done by this plugin ?
Are stylesheets for every page request regenerated, or only once on server start ?

Option source add CSS folder to my path

Hi,

I used the module with express 4 and when I put the path to the source folder it suffix him with the css folder :

Here is the code :

  app.use(sassMiddleware({
    src: path.join(__dirname,  '../assets/sass'),
    dest: path.join(__dirname,  '../assets'),
    debug: true,
    outputStyle: 'expanded',
    prefix: '/assets',
  }));

image

Is it a normal feature ? Or maybe i'm doing something wrong ?
Thanks

race condition

Basically the "options" object which gets passed into node-sass, is modified by node-sass, but it's reused as a module global within node-sass-middleware.
So if more than one request is in flight, they end up stomping on each other and havoc ensues, including the callbacks getting jumbled (which manifests itself as res.sendHeader() throwing errors about the headers already been sent).

I cloned locally and made a simple fix to just clone the options object for each request. It works and gets past the problem. Could one of the maintainers review and see if you want to take this, or do a similar fix?

diff --git a/middleware.js b/middleware.js
index 36be2ed..c31356f 100644
--- a/middleware.js
+++ b/middleware.js
@@ -5,6 +5,7 @@ var sass = require('node-sass'),
url = require('url'),
dirname = require('path').dirname,
mkdirp = require('mkdirp'),

  • extend = require('extend'),
    join = require('path').join;

var imports = {};
@@ -95,7 +96,7 @@ module.exports = function(options) {
};

// Middleware

  • return function sass(req, res, next) {
  • function sass_middleware(options, req, res, next) {
    if (req.method != 'GET' && req.method != 'HEAD') {
    return next();
    }
    @@ -282,6 +283,10 @@ module.exports = function(options) {
    });
    });
    }
  • return function(req, res, next) {
  • return sass_middleware(extend({}, options), req, res, next);
  • }
    };

/**
diff --git a/package.json b/package.json
index 74ca39f..f9a4b31 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
"node": ">=0.10.0"
},
"dependencies": {

  • "extend": "^3.0.0",
    "mkdirp": "^0.5.1",
    "node-sass": "^3.3.2"
    },

Update to support node-sass ^2.0.0 and Node 0.12

I have forked the project and am trying to get tests to run after upgrading the package requirements to node-sass ^2.0.0, since this module will not install under Node 0.12.

Of course, I can't seem to get it to work or I would just submit a PR. Maybe you can figure out what's up?

Doesn't log to console when sass file is invalid

There is no callback for checking errors nor logs to console. So, it is a bit hard to identify problem.
Maybe it's because I use it without connect module.

// middleware.js
module.exports = function(options, cb){ // line 44

if (err) { cb(err); return next(err); } // line 115

// when using
app.use('/stylesheets', sassMiddleware({
  src: "./public/stylesheets/",
  debug: true,
  outputStyle: 'expanded'
}, function(err){
   console.log(err);
}));

Tests

Were there ever tests for this package? Any preference on how tests are set up and what packages to use for testing? Maybe a collaborator should start off the repo with a couple tests so there is an example to follow for anyone who is contributing.

Problem with Express and nodemon

Hi, i have the next package for my app:

express": "^4.16.2",
    "node-sass-middleware": "^0.11.0",
    "react": "^16.1.1",
    "react-dom": "^16.1.1"

And in my server file i have this code:

import sassMiddleware from 'node-sass-middleware';
import path from 'path';
import express from 'express';
const server = express();

server.use(sassMiddleware({
  src: path.join(__dirname, 'sass'),
  dest: path.join(__dirname, 'public')
}));

I run this code with nodemon and i getting this problem:

[nodemon] restarting due to changes...
[nodemon] starting `babel-node server.js`
[nodemon] app crashed - waiting for file changes before starting...

It happen with the import line for node-sass-middleware, if i delete it all is well.

What's the problem here?

Installation problem, please help!

I installed node-sass-middleware with npm install -g and then npm link at my work directory. Everything seems fine. But when I try starting my app with supervisor, I always get the following error:

Running node-supervisor with
  program 'app.js'
  --watch '.'
  --extensions 'node,js'
  --exec 'node'

Starting child process with 'node app.js'
Watching directory '/Website_Server/t47io/main' for changes.
Press rs for restarting the process.
fs.js:761
  return binding.readdir(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/usr/local/lib/node_modules/node-sass-middleware/node_modules/node-sass/vendor'
    at Error (native)
    at Object.fs.readdirSync (fs.js:761:18)
    at Object.getInstalledBinaries (/usr/local/lib/node_modules/node-sass-middleware/node_modules/node-sass/lib/extensions.js:74:13)
    at foundBinariesList (/usr/local/lib/node_modules/node-sass-middleware/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/usr/local/lib/node_modules/node-sass-middleware/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/usr/local/lib/node_modules/node-sass-middleware/node_modules/node-sass/lib/errors.js:45:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/node-sass-middleware/node_modules/node-sass/lib/index.js:14:28)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
Program node app.js exited with code 1

I have no idea what's wrong. What should be in that vendor folder? My app.js: (excerpt)

...
var sass = require('node-sass-middleware');
...
app.use( sass({
    'src': path.join(root, 'sass/'),
    'dest': path.join(root, 'css/'),
    'degug': DEBUG
}) );
app.use( express.static(root) );
...

How should I fix the node-sass install? It is currently node-sass 3.7.0 and node-sass-middleware 0.9.8. Why is the vendor folder not set up correctly by npm install itself?

node scripts/build.js failing

Hi,

I'm trying to install node-sass-middleware with npm and a error occured:

Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/causztic/Work/grafiore/node_modules/node-sass-middleware/node_modules/node-sass/lib/index.js:181:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)

npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "node-sass-middleware"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE

Any ideas?

No `prefix` option anymore?

How can I get the debug's source to have a different path than the request?

For example:

GET: /styles/global.css
Source: /public/sass/global.css
Dest/Read: /public/styles/global.css

Currently it is:

GET: /styles/global.css
Source: /public/sass/styles/global.css
Dest/Read: /public/styles/styles/global.css

How can I set up the middleware to do the former?

Compiling issues for certain routes

I'm using node-sass-middleware in my Express app. It's working for the main routes (home/sign-in/sign-up etc), but when I request a route like '/collections', it changes the source path and looks for the scss file in a directory that doesn't exist.

Could you help me out on how to solve this?

The problem is not that __dirname is changing, as you can see, the middleware is looking for '/collection' after the __dirname, which is the same in both cases.

app.js

app.use(sassMiddleware({
         src: (__dirname + '/sass'),
         dest: (__dirname + '/public'),
         debug: true,
         })
);

Directory

routes(folder)
...index.js
...collections.js

Terminal messages -

(route - '/sign-in') /Users/Daniel/code/dansiberry/learnbox/sass/app.scss

(route - '/collections/new') /Users/Daniel/code/dansiberry/learnbox/sass/collections/app.scss does not exist

prefix ignored when running

I have two calls for css files in my index.html, one uses the prefix the other does not. Both css files are picked up by sass-middleware instead of just the one with the prefix.

My config looks like this:

{
    src: path.join(__dirname, './client/sass'),
    dest: path.join(__dirname, './dist'),
    debug: true,
    outputStyle: 'compressed',
    prefix:  '/css'
}

I have links in my html that look like:

<link rel="stylesheet" href="/css/app.css" type="text/css">
<link rel="stylesheet" href="/outdated-browser/outdatedbrowser.min.css" type="text/css">

I am aware that I can just put the express.static method for outdated browser above the sass middleware and it won't get picked up by the middleware but the middleware shouldn't be picking it up anyway.

New server run doesn't create new css (force=false)

It seems like when setting force=false a new build is created only when restarting the server.
But, in lately when we restart our express server (on windows) no new build is created until the previous css is deleted.

Installation fails at downloading bindings

I tried installing node-sass-middleware but it fails to download the bindings and crashes because node-gyp is not installed.
Log
I tried installing it with Node.js 0.12.0 with npm 2.5.1 and IO.js 1.5.1 and npm 2.7.1

Destination CSS file doesn't exist

Hey everyone,

I would like my Sass files to be compiled to a different folder, not the same folder as my Sass files, but dest isn't respected for some reason. Neither is outFile. Has anyone else gotten this to work?

node-sass download

I have installed latest node '6.0.0' and when i try to install this i see Cannot download "https://github.com/sass/node-sass/releases/download/v3.6.0/win32-x64-48_binding.node": and in the node-sass there is no -48 version.

Custom Source filename

Hey,
I am using:

		app.use(
			sass({
				src: path.join(__dirname, '/common/sass'),
				dest: path.join(__dirname, '../wwwroot/stylesheets'),
				prefix: '/stylesheets',
			})
		)

but it will only pick up the sass file if I call it "style.scss" instead of "bootstrap.scss" for example. Is there a way to specify the source filename? I'd like to keep it named bootstrap.scss instead of style.scss.

Same question applies to the dest filename, can I give it a custom name which differs from the source css filename?

CSS isn't compiled after the first success?

I'm running into a weird issue using this middleware with Express. Here is our usage:

var sass = require('node-sass-middleware');
app.use('/css', sass({
  src: __dirname + '/style/sass',
  dest: __dirname + '/style/css',
  outputStyle: 'nested',
  debug: true,
  force: true,
  sourceMap: true
}));

Our issue is that if we don't pass force: true, the CSS for our source file only compiles successfully the first time, and 404s after that. I've cloned the repo and added a test case that attempts to simulate this by simply requesting a stylesheet twice in a row, but I can't reproduce it.

Here's what happens on the console:

  1. The first request outputs the sass middleware's debug messages, as expected:

    source: /Users/allens/work/eiti-data/style/sass/main.scss
    dest: /Users/allens/work/eiti-data/style/css/main.css
    read: /Users/allens/work/eiti-data/style/css/main.css
    render: /Users/allens/work/eiti-data/style/sass/main.scss
    render: /Users/allens/work/eiti-data/style/css/main.css.map
    source: /Users/allens/work/eiti-data/style/sass/main.scss
    dest: /Users/allens/work/eiti-data/style/css/main.css
    
  2. The second time around, nothing happens and Express returns a 404.

  3. The third time around, the middleware outputs just the source and dest paths, but no render calls:

    source: /Users/allens/work/eiti-data/style/sass/main.scss
    dest: /Users/allens/work/eiti-data/style/css/main.css
    

I can try to create a standalone test case for this if you'd like, but I just wanted to make sure that I'm not doing something glaringly wrong or missing something totally obvious. As you can see, there's nothing very complex going on in our SCSS source. Thank you!

sassMiddlewareError never emptied

When developing, if I make a mistake in my SCSS, node-sass-middleware duly logs it and that's very good. But when I fix the mistake and save the file (and on any further save too) the CSS request that triggers the recompile fails, probably because sassMiddlewareError is never emptied.

I'm using it with Express like this:

app.use(sassMiddleware({
    src: 'webpages',
    outputStyle: 'expanded',
    response: false,
  }));

Expected behaviour: an error is logged once, successful recompiles result in successful response.

Observed behaviour: once an error happens, every new recompile logs it even if the compile didn't encounter any errors this time; the recompile request gets an internal server error result.

vendor/darwin-x64-46/binding.node Missing After npm install

Hello,

I recently deleted all of my node_modules for a particular project off of git in order to reduce it's size (no surprises here), and after running npm install on my local directory, I was no longer able to run my application because node_modules/node-sass-middleware/node_modules/node-sass/vendor cannot be found -- and it is in fact missing.

I originally installed this package with the Express generator.

Any ideas? I'd be happy to provide more detail or set up a time to track this issue.

Thanks!
Adam

force: true not working for @import?

Hello there.

I am using node-sass-middleware in a very simple configuration, I just want it to write the file, and Express serves it as static. So far, so good.

It works fine when the output file is not present, but does not regenerate if one of my @imports changes, not even with force:true

Maybe I am using this wring, it's entirely possible.

app.use(sass({
  src: path.join(__dirname, '/views/client/styles'),
  dest: path.join(__dirname, '/views/client/styles'),
  force: true,
  debug: true,
  outputStyle: 'compressed',
  prefix: '/styles'
}));

Any clues as to why this might be, and how I can avoid that?

Cheers,
Martin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.