New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cantina-assets

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cantina-assets

Asset aggregator and minifier for Cantina applications.

  • 4.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-57.89%
Maintainers
2
Weekly downloads
 
Created
Source

Cantina: Assets

Asset aggregator and minifier for Cantina applications.

Note: Currently very specific to a particular use-case (RequireJS/Marionette/Plain CSS).

Provides

  • app.assets - The Assets API

Configuration

Specify your app's CSS and JS files via styles and scripts keys, respectively, in your conf. Then setup how cantina-assets should handle them:

{
  "assets": {
    "optimize": "enabled" // Will run all optimizers on `app.start()`
    "css": {
      "foo": { // Custom namespaces allow for multiple aggregates.
        "root": "/path/to/dir",
        "dirs": [ // Additional directories from which to fetch "/public" files.
          "/path/to/assets",
          "/another/path"
        ],
        "aggregate": true,
        "prefix": true,
        "minify": true,
        "serve": true
        "match": [ // Define an array of RegEx patterns to match files against.
          "^/foo"
        ],
        "exclude": [ // Define an array of RegEx patterns to exclude files.
          "^do",
          "not",
          "want$"
        ]
      }
    },
    "js": {
      "bar": {
        "aggregate": true,
        "minify": true,
        "serve": true
        "match": [
          "^/bar"
        ]
      }
    },
    "templates": {
      "baz": {
        "aggregate": true,
        "minify": false
      }
    }
  }
}

Usage

If app.conf.get('assets:optimize') === 'enabled' then your assets will be run through the optimization steps as soon as app.start() is called, respecting all flags per namespace.

API

app.assets.[css|js|templates].aggregate (namespace, cb)

Aggregates asset files into one file, as per the conf's namespace definition.

app.assets.[css|js|templates].minify (namespace, cb)

Minifies asset files (only applies if they are aggregated as well).

app.assets.css.prefix (namespace, cb)

Adds certain vendor-prefixes to CSS attributes (only applies if they are aggregated as well).

app.assets.[css|js|templates].serve (namespace, cb)

Serves the optimized assets via dish (only applies if they are aggregated as well).

app.assets.[css|js|templates].[aggregate|minify|prefix|serve]All (cb)

Runs modifier on all namespaces.

app.assets.[css|js|templates].optimize (cb)

Runs all modifiers on all namespaces.


Developed by Terra Eclipse

Terra Eclipse, Inc. is a nationally recognized political technology and strategy firm located in Santa Cruz, CA and Washington, D.C.

Keywords

FAQs

Package last updated on 24 Mar 2015

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