Automatically inject Bower component into the HTML file automatically injects components of Bower into HTML files
If we install the components in the following ways
Bower Install jquery--savebower Install sea.js--save
It will be seen in the Bower.json file after installation
{ "name": "Framework-demo", "private": True, "dependencies": { "jquery": "~2.1.4", "Jquery-ui" : "~1.11.4", "Knockout": "^3.3.0", "Seajs": "^3.0.0" }}
Configuring WIRDEP Task in the Gruntfile.js file
WIREDEP: { app: { src: [' <%= Config.app%>/index.html '], ignorepath:/^ (\.\.\/) *\.\./ } }
Execute Grunt WIREDEP command
In the index.html file, the components in the default dependencies dependency are automatically injected into the following tabs.
<!--Bower:js-- <script src= "/bower_components/jquery/dist/jquery.js" ></script> < Script src= "/bower_components/jquery-ui/jquery-ui.js" ></script> <script src= "/bower_components/ Knockout/dist/knockout.js "></script>
Parameter devdependencies in option in WIREDEP: Inject the dependency component in the development version, dependencies: inject the dependent component; directory: ' The directory of your Bower packages. ' The directory that holds the Bower package, which is a. Directory in the '. BOWERRC ' file.
Configuration documentation for WIREDEP tasks for grunt