question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Invalid mapping" when serving compiling bootstrap-sass via the css helper method

See original GitHub issue

Demo app here: http://github.com/deployable/sass-issue

git clone http://github.com/deployable/sass-issue
npm install
npm test
npm start

connect-assets can serve the .css and .css.map files ok

curl http://localhost:3001/assets/bootstrap.css
curl http://localhost:3001/assets/bootstrap.css.map

The node-sass binary can generate the css and map files fine

$ cd app/assets/css/
$ ../../../node_modules/.bin/node-sass -o . --source-map true bootstrap.sass 
Rendering Complete, saving .css file...
Wrote CSS to /sass-issue/app/assets/css/bootstrap.css
Wrote Source Map to /sass-issue/app/assets/css/bootstrap.css.map

When using the css() method in dev mode, the following “Invalid mapping” error is thrown

{ Error: /sass-issue/app/views/index.pug:7
    5|     meta(name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no")
    6| 
  > 7|     != css("bootstrap")
    8|     != js("jquery")
    9|     != js("bootstrap")
    10| 

Invalid mapping: {"generated":{"line":1432,"column":28},"source":"bootstrap-sass/bootstrap/_type.scss","original":{"line":286,"column":-1},"name":null}
    at SourceMapGenerator_validateMapping [as _validateMapping] (/sass-issue/node_modules/source-map/lib/source-map-generator.js:277:13)
    at SourceMapGenerator_addMapping [as addMapping] (/sass-issue/node_modules/source-map/lib/source-map-generator.js:101:12)
    at /sass-issue/node_modules/source-map/lib/source-node.js:345:13
    at SourceNode_walk [as walk] (/sass-issue/node_modules/source-map/lib/source-node.js:224:9)
    at SourceNode_walk [as walk] (/sass-issue/node_modules/source-map/lib/source-node.js:220:13)
    at SourceNode_walk [as walk] (/sass-issue/node_modules/source-map/lib/source-node.js:220:13)
    at SourceNode_toStringWithSourceMap [as toStringWithSourceMap] (/sass-issue/node_modules/source-map/lib/source-node.js:336:8)
    at new BundledAsset (/sass-issue/node_modules/mincer/lib/mincer/assets/bundled.js:94:31)
    at Index.Base.buildAsset (/sass-issue/node_modules/mincer/lib/mincer/base.js:535:12)
    at /sass-issue/node_modules/mincer/lib/mincer/index.js:141:26
    at Index.module.exports.cacheAsset (/sass-issue/node_modules/mincer/lib/mincer/helpers/caching.js:52:12)
    at Index.buildAsset (/sass-issue/node_modules/mincer/lib/mincer/index.js:140:33)
    at Index.Base.findAsset (/sass-issue/node_modules/mincer/lib/mincer/base.js:348:15)
    at Index.findAsset (/sass-issue/node_modules/mincer/lib/mincer/index.js:114:22)
    at Environment.findAsset (/sass-issue/node_modules/mincer/lib/mincer/environment.js:137:21)
    at Assets.getAssetByPath (/sass-issue/node_modules/connect-assets/lib/assets.js:230:29)
    at /sass-issue/node_modules/connect-assets/lib/assets.js:180:22
    at eval (eval at wrap (/sass-issue/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:14:46)
    at template (eval at wrap (/sass-issue/node_modules/pug-runtime/wrap.js:6:10), <anonymous>:24:98)
    at Object.exports.renderFile (/sass-issue/node_modules/pug/lib/index.js:410:38)
    at Object.exports.renderFile (/sass-issue/node_modules/pug/lib/index.js:400:21)
    at View.exports.__express [as engine] (/sass-issue/node_modules/pug/lib/index.js:447:11)
    at View.render (/sass-issue/node_modules/express/lib/view.js:126:8)
    at tryRender (/sass-issue/node_modules/express/lib/application.js:639:10)
    at EventEmitter.render (/sass-issue/node_modules/express/lib/application.js:591:3)
    at ServerResponse.render (/sass-issue/node_modules/express/lib/response.js:960:7)
    at app.get (/sass-issue/app/index.js:10:32)
    at Layer.handle [as handle_request] (/sass-issue/node_modules/express/lib/router/layer.js:95:5)
    at next (/sass-issue/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/sass-issue/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/sass-issue/node_modules/express/lib/router/layer.js:95:5)
    at /sass-issue/node_modules/express/lib/router/index.js:277:22
    at Function.process_params (/sass-issue/node_modules/express/lib/router/index.js:330:12)
    at next (/sass-issue/node_modules/express/lib/router/index.js:271:10)
    at middleware (/sass-issue/node_modules/connect-assets/index.js:46:7)
    at Layer.handle [as handle_request] (/sass-issue/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/sass-issue/node_modules/express/lib/router/index.js:312:13)
    at /sass-issue/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/sass-issue/node_modules/express/lib/router/index.js:330:12)
    at next (/sass-issue/node_modules/express/lib/router/index.js:271:10)
    at expressInit (/sass-issue/node_modules/express/lib/middleware/init.js:33:5)
    at Layer.handle [as handle_request] (/sass-issue/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/sass-issue/node_modules/express/lib/router/index.js:312:13)
    at /sass-issue/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/sass-issue/node_modules/express/lib/router/index.js:330:12)
    at next (/sass-issue/node_modules/express/lib/router/index.js:271:10)
    at query (/sass-issue/node_modules/express/lib/middleware/query.js:44:5)
    at Layer.handle [as handle_request] (/sass-issue/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/sass-issue/node_modules/express/lib/router/index.js:312:13)
    at /sass-issue/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/sass-issue/node_modules/express/lib/router/index.js:330:12)
    at next (/sass-issue/node_modules/express/lib/router/index.js:271:10)
    at Function.handle (/sass-issue/node_modules/express/lib/router/index.js:176:3)
    at EventEmitter.handle (/sass-issue/node_modules/express/lib/application.js:173:10)
    at Server.app (/sass-issue/node_modules/express/lib/express.js:38:9)
    at emitTwo (events.js:106:13)
    at Server.emit (events.js:191:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

$ node -v
v6.9.2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
deployablecommented, Jun 30, 2017

@flandrade No, I ending up building a gulp based asset pipeline that resembles the connect-assets layout and helpers. The assets are pre built so all the build dependencies are taken out of the production app.

0reactions
stale[bot]commented, Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sass - Bootstrap 5 beta SCSS compiling error Invalid CSS
As I can see and understand your trying to compile the bootstrap bootstrap-grid.scss. Syntax of bootstrap-grid.scss is
Read more >
Gulp error - Invalid Mapping + JSON.stringify - Roots Discourse
This issue is caused by an upstream error in Libsass. Replace gulp-minify-css with gulp-clean-css . Upgrade/downgrade gulp-sass to version 2.3 ...
Read more >
Theming Bootstrap
Bootstrap 4 provides a familiar, but slightly different approach. Now, theming is accomplished by Sass variables, Sass maps, and custom CSS.
Read more >
Changelog - scssphp - GitHub Pages
SCSS compiler written in PHP. ... map-has-key and map-merge (@stof). Fixed. Preserve the type of keys when iterating over maps (@stof) ...
Read more >
Dart Sass Command-Line Interface
By default, error CSS is enabled if you're compiling to at least one file on disk (as opposed to standard output). You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found