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

asset-wrap

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asset-wrap

Asset management framework for nodejs

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
162
increased by153.13%
Maintainers
1
Weekly downloads
 
Created
Source

Wrap Multiple Assets

wrap = require 'asset-wrap'
assets = wrap.AssetWrap [
  new wrap.Stylus {
    src: "#{__dirname}/path/to/app.styl"
    dst: '/css/app.css'
    compress: true
  }
  new wrap.Snockets {
    src: "#{__dirname}/path/to/app.coffee"
    dst: '/js/app.js'
    compress: false
  }
], {
  AmazonS3:
    key: ''
    secret: ''
  CloudFiles:
    key: ''
    secret: ''
}

assets.on 'complete', () ->
  console.log 'assets compiled'

app.configure () ->
  app.use assets.middleware

@get '/': ->
  @render index: {
    assets: assets
  }

@view index: ->
  head ->
    @assets.tag '/css/app.css'
    @assets.tag '/js/app.js'

# Wrap Single Asset - Wrap explicitly
wrap = require '../src/wrap'
asset = new wrap.Snockets {
  src: "#{__dirname}/test.coffee"
  dst: '/js/app.js'
}
asset.on 'complete', () ->
  console.log asset.src
  console.log asset.dst
  console.log asset.md5
  console.log asset.url
  console.log asset.data
  console.log asset.tag
asset.wrap()

# Wrap Single Asset - Wrap on Construction
asset = new wrap.Snockets {
  src: "#{__dirname}/test.coffee"
  dst: '/js/app.js'
}, (asset) ->
  console.log asset.src
  console.log asset.dst
  console.log asset.md5
  console.log asset.url
  console.log asset.data
  console.log asset.tag


# Wrap Single Asset with Zappa
@get '/js/app.js': ->
  new wrap.Snockets {
    url: '/js/app.js'
    src: "#{__dirname}/path/to/app.coffee"
  }, (asset) =>
    @response.setHeader 'Content-Type', 'text/javascript'
    @response.write asset.data

FAQs

Package last updated on 17 Jan 2013

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