connect-assets-cdn
A connect-assets helper for uploading built assets to a CDN (like Amazon S3)
Last updated 7 years ago by jgable .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install connect-assets-cdn 
SYNC missed versions from official npm registry.

connect-assets-cdn Build Status

A helper module for connect-assets to upload your files to a CDN (like Amazon S3)

Installation

npm install connect-assets-cdn

Usage

assets = require 'connect-assets'
{AssetsCDN} = require 'connect-assets-cdn'

# Snip ...

app.use assets
	servePath: '//s3.amazonaws.com/S3_Bucket'

# You should probably only upload for production
if process.env.NODE_ENV == "production"

	cdn = new AssetsCDN 
		assets: assets
		key: "S3_Key"
		secret: "S3_Secret"
		bucket: "S3_Bucket"

	cdn.upload (err, uploadedPaths) ->
		throw err if err

		app.listen 3000, (err) ->
			console.log "Server started"

TODO:

  • Check if files exist already on CDN before uploading

Thanks

Made possible thanks to connect-assets, s3-client, knox.

Copyright

Created by Jacob Gable. MIT License; no attribution required.

Current Tags

  • 0.1.5                                ...           latest (7 years ago)

6 Versions

  • 0.1.5                                ...           7 years ago
  • 0.1.4                                ...           8 years ago
  • 0.1.3                                ...           8 years ago
  • 0.1.2                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 1
Last Month 2
Dependencies (4)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |