How to use Bower source mapping with building tools?

The Bower section of the Package Consumption documentation reads:

Bower also provides the original mapping. This can be used by build tools to easily consume Bower packages.

Then it illustrates JSON, which you can output with a simple command:

{
  "backbone": "bower_components/backbone/index.js",
  "jquery": "bower_components/jquery/index.js",
  "underscore": "bower_components/underscore/index.js"
}

I understand what is happening here ... but I really do not understand why this is necessary, i.e. how to use it.

I could not find examples of people using such a source map, and it was not easy for me to understand what the Bower docs offer. I am wondering how this JSON created by Bower can be used by build tools to use packages, easily.

Somebody knows? Has anyone done this or saw it done?

+3
1

( , ) --paths - . , , .

, , Bower , Grunt /. ? Bower , , "app/_bower_components/packageName/", , , , , / JS.

Grunt , "uglify", JS , . Grunt :

        uglify: {
        modernizr: {
            files: {
                'javascripts/modernizr.min.js': 'app/_bower_components/modernizr/modernizr.js'
            }
        }

Bower, (.. ), ( javascripts/modernizr.min.js) .

, Grunt, "" Bower . , Uglify , Bower / , . , , , JQuery, Bower ; , .

+2

All Articles