Manuel Darveau Manuel Darveau - 3 months ago 16
Javascript Question

How to generate map files for CSS in a sails app?

Hi have a sails project with bootstrap included in bower.json:

...
"dependencies": {
...
"bootstrap": "~3.2.0"
...
}


All the css, fonts and js are copied correctly but the map file is not copied to the
assets/vendor/bootstrap
directory nor the
.tmp
dir.

I can't figure out what process copies the filed from
bower_components/bootstrap/dist/css
where the
bootstrap.css.map
file does exists.

There must be something from
tasks/config/bower.js
but I am a bit puzzled on how bower know which files to copy. Especially since the default
layout: 'byType'
does not match the
assets/vendor
at all so there must be something else I am missing.

Thanks

Answer

I fixed the issue by adding the following to bower.json:

...
"exportsOverride": {
  "bootstrap": {
      "css": ["dist/css/bootstrap.css",
               "dist/css/bootstrap.css.map"],
      "js": "dist/js/bootstrap.js",
      "fonts": "dist/fonts"
  }
}
...

This is also a fix to copy fonts. See http://blog.mdarveau.com/2014/10/10/using-fontawesome-and-glyphicons-in-a-sails-app