Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assetslocals

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assetslocals

combine assets.json file and locals.js, It can be used in jade and grunt.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

assetsLocals

combine assets.json file and locals.js, It can be used in jade and grunt.

合并assets.json和locals的内容,方便jade或是grunt调用.

assets.json AssetManager.

locals.js Expressjs app.locals.

install

$ npm install assetslocals
app.locals = assetslocals({
	localsFile: require('./config/locals'),
	assetmanagerOptions: {
		assets: require('./config/assets.json'),
		debug: (process.env.NODE_ENV !== 'production'),
		webroot: 'public/'
	}
});

locals.js

module.exports = {
  appName:"myApp",
  lang:"cn",
  title:"wow myApp",
  description:"balabala",
  pretty: true, //jade setting
  NODE_ENV:"development" //for jade
};

assets.json

{
  "vendor": {
    "css": {
      "bin/css/vendor.css": [
        "public/bower_components/angular-loading-bar/build/loading-bar.min.css",
        "public/bower_components/bootstrap/dist/css/bootstrap.min.css"
      ]
    },
    "js": {
      "bin/js/vendor.js": [
        "public/bower_components/angular/angular.min.js",
        "public/bower_components/angular-animate/angular-animate.min.js",
        "public/bower_components/angular-loading-bar/build/loading-bar.min.js",
        "public/bower_components/bootstrap/dist/js/bootstrap.min.js",
        "public/bower_components/angular-bootstrap/ui-bootstrap.min.js",
        "public/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js",
        "public/bower_components/angular-ui-router/release/angular-ui-router.min.js"
      ]
    },
    "ie": {
      "bin/js/Modernizr-repond.js": [
        "public/bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js",
        "public/bower_components/respond/dest/respond.min.js"
      ]
    }
  },
  "main": {
    "css": {
      "bin/css/main.css": ["public/css/main.css"]
    },
    "js": {
      "bin/js/main.js": [
        "public/js/*.js"
      ]
    }
  }
}

test.jade

each item in locals.assets.js
  script(src=item)
each item in locals.assets.css
  link(rel='stylesheet', href=item)

gruntfile.js jade config

jade: {
    options: {
        pretty: true,
        data: function(dest, src) {
            return require('assetsLocals')({
                localsFile: require('./config/locals'),
                assetmanagerOptions: {
                    assets: require('./config/assets.json'),
                    debug: (process.env.NODE_ENV !== 'production'),
                    webroot: 'public/'
                }
            });
        }
    }
}

Keywords

FAQs

Package last updated on 25 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc