简体   繁体   中英

How to add JavaScript module to generator-meanjs app?

I want to add some JavaScript module to my application made by meanjs-generator for Yeoman, but the modules' script tags aren't generated to index.html. I just added the modules through bower and I didn't touch any other files because generated files by the generator seem to look for .js files and add them to index.html automatically.

What is the correct way to add JavaScript module?

After executed bower command, you have to add your .js or .css file paths to config/env/all.js like as follows:

module.exports = {
    ...
    assets: {
        lib: {
            css: [
                'public/lib/bootstrap/dist/css/bootstrap.css',
                'public/lib/bootstrap/dist/css/bootstrap-theme.css',
            ],
            js: [
                'public/lib/ng-file-upload/angular-file-upload-shim.js',
                'public/lib/angular/angular.js',
                'public/lib/angular-resource/angular-resource.js', 
                'public/lib/angular-cookies/angular-cookies.js', 
                'public/lib/angular-animate/angular-animate.js', 
                'public/lib/angular-touch/angular-touch.js', 
                'public/lib/angular-sanitize/angular-sanitize.js', 
                'public/lib/angular-ui-router/release/angular-ui-router.js',
                'public/lib/angular-ui-utils/ui-utils.js',
                'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
                'public/lib/ng-file-upload/angular-file-upload.js'
            ]
        },
    ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM