Giter Club home page Giter Club logo

asset-rack's People

Contributors

broberson avatar d1plo1d avatar dragory avatar garth avatar jeromegn avatar jgable avatar johngeorgewright avatar maksjs avatar moellenbeck avatar mstorus avatar noc7c9 avatar scriste-sv avatar skw avatar techpines avatar vicapow avatar vincentwoo avatar xdissent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asset-rack's Issues

Hm.. second asset not working

This is weird, I am creating two assets:

assets = new rack.Rack([
  new LiveScriptAsset(
     url: 'js/controllers.js',
     filename: __dirname + '/client/app/ls/controllers.ls'
  ),
  new LiveScriptAsset(
     url: 'js/app.js',
     filename: __dirname + '/client/app/ls/app.ls'
  )
])
app.use(assets)

but only the js/app.js is accessible... the other gives me 404 not found. Am I doing something wrong?

For reference my LiveScriptAsset code:

rack = require \asset-rack
fs = require \fs
ls = require \LiveScript
require('events').EventEmitter

LiveScriptAsset = rack.Asset.extend({
   create : !(options) ->
               lsSource = fs.readFileSync(options.filename).toString('utf8')
               @contents = ls.compile(lsSource)
               @emit \created
})
module.exports = LiveScriptAsset

Pass on dynamic values to BrowserifyAsset on the fly

Hello guys

First of all, big compliments! This module is the best, much better than all the other crap out there. Finally something that works, caches and hashes well. Big thanks.

So, I'm a beginner with this module, not sure if it's possible or not (a feature request). Would be great if I can pass on dynamic values to any BroserifyAsset on the fly.

For example I have:

var assets = new rack.Rack([
    ...,
    new rack.BrowserifyAsset({
        url:        '/j/app.js',
        filename:   publicFolder + '/j/app.js',
        compress:   app.get('compress'),
        xxx:  app.settings
    })
]);

app.use(assets);

You see, I would love to pass on the app.settings to the client javascript with a new property xxx whose name we need to invent if that's not implemented yet.

A huge advantage is that I can share a single configuration for server and client both. I know I could use require to load the configuration file but I'm modifying some application settings during the boot process on the fly. Hence I need such a feature.

Thanks,
Michael

Cannot read property length of undefined

/code/sails/node_modules/asset-rack/compiled/modules/less.js:101
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                              ^
TypeError: Cannot read property 'length' of undefined
at ensureLessError (/code/sails/node_modules/asset-rack/compiled/modules/less.js:101:31)
    at /code/sails/node_modules/asset-rack/compiled/modules/less.js:57:40
    at finish (/code/sails/node_modules/asset-rack/node_modules/less/lib/less/parser.js:472:28)
    at /code/sails/node_modules/asset-rack/node_modules/less/lib/less/parser.js:105:48
    at /code/sails/node_modules/asset-rack/node_modules/less/lib/less/index.js:134:13
    at Object.Parser.parser.parse (/code/sails/node_modules/asset-rack/node_modules/less/lib/less/parser.js:476:17)
    at parseFile (/code/sails/node_modules/asset-rack/node_modules/less/lib/less/index.js:133:12)
    at fs.js:252:14
    at Object.oncomplete (fs.js:93:15)

Anyone else seen this?

Can't install

@techpines Hey Brad, I can't install asset rack at 2.1.4 or 2.1.5 right now via npm with a clean node_modules directory:

On the latest version of node and npm:

host081:sails mike$ npm -v
1.2.16
host081:sails mike$ node -v
v0.10.0
host081:sails mike$ 
npm WARN engine [email protected]: wanted: {"node":"0.6.x || 0.8.x"} (current: {"node":"v0.10.0","npm":"1.2.16"})
npm ERR! Error: ENOENT, lstat '/code/sails/node_modules/asset-rack/node_modules/jade/LICENSE'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/jade/LICENSE
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/jade/LICENSE
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat '/code/sails/node_modules/asset-rack/node_modules/underscore/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/underscore/README.md
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/underscore/README.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, chown '/code/sails/node_modules/asset-rack/node_modules/node-sassy/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/node-sassy/README.md
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/node-sassy/README.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chown
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:222:7
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/code/sails/node_modules/asset-rack/node_modules/browserify'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir '/code/sails/node_modules/asset-rack/node_modules/browserify']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/code/sails/node_modules/asset-rack/node_modules/browserify' }
npm ERR! Error: ENOENT, open '/code/sails/node_modules/asset-rack/node_modules/mime/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/mime/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! EEXIST, mkdir '/code/sails/node_modules/asset-rack/node_modules/nib'
File exists: /code/sails/node_modules/asset-rack/node_modules/nib
Move it away, and try again. 

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/nib
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/nib/History.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat '/code/sails/node_modules/asset-rack/node_modules/coffee-script/README'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/coffee-script/README
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/coffee-script/README
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat '/code/sails/node_modules/asset-rack/node_modules/stylus/bm.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/stylus/bm.js
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/stylus/bm.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat '/code/sails/node_modules/asset-rack/node_modules/snockets/Cakefile'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/snockets/Cakefile
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/snockets/Cakefile
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat '/code/sails/node_modules/asset-rack/node_modules/pkgcloud/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "asset-rack"
npm ERR! cwd /code/sails
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.16
npm ERR! path /code/sails/node_modules/asset-rack/node_modules/pkgcloud/README.md
npm ERR! fstream_path /code/sails/node_modules/asset-rack/node_modules/pkgcloud/README.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /code/sails/npm-debug.log
npm ERR! not ok code 0
host081:sails mike$ 

StaticAssets should serve index.html at /

It would be nice to have a new option for StaticAssets called something like serveIndex that defaults to true. When true, it would automatically serve index.html when a browser requests /.

In the meantime, here is a workaround:

var rack = require ('asset-rack');
var fs = require('fs');

var assets = new rack.Rack([
    new rack.StaticAssets({
        urlPrefix: '/',
        dirname: __dirname + '/../../splash'
    }),
    new rack.Asset({
        url: '/',
        contents: fs.readFileSync(__dirname + '/../../splash/index.html').toString(),
        mimetype: 'text/html'
    }),
]);

AngularTemplatesAsset should support Jade templates

We're using Jade for our Angular templates. How would you feel about a pull request that caused AngularTemplatesAsset to look for Jade assets as well as HTML, and that automatically compiles any Jade files it found? Does it even need an option to turn off the Jade compilation functionality?

Separately, our HTML page will then be referencing 3 fingerprinted files: the site Javascript bundle, the site CSS bundle, and the site AngularTemplates bundle. What's the possibility of combining 1 and 3 into a single bundle?

assets.deploy() is creating one file with 0 bytes

I am using following function to deploy assets. But, I always see one file with size of 0 bytes in the container. File gets the correct hashed url though. Tried to understand source but I am not familiar with coffee syntax.

Is this an issue in asset-rack or an issue in my function. Following is my function

function memento_io() {
    var assets = new rack.Rack([
        new rack.StaticAssets({
            urlPrefix: '/',
            dirname: __dirname + '/public'
        })
    ]);

    assets.on('complete', function(){
        console.log(assets);
        this.deploy({
            provider: 'rackspace',
            container: 'memento_io',
            username: config.cdn["username"],
            apiKey: config.cdn.api_key,
        }, function(error) {
            if(error) {
                console.log(error);
            }
            console.log(':)');
        });
    });
}
memento_io();

How do I concatenate js and css files?

I would like to concatenate all my javascript files into one js file and all my css files into one css file. As far as I can see, for JS I would have to use a SnocketsAsset, but for CSS there does not seem to be an equivalent (can I just use SnocketsAsset for css as well?).

However, I cannot understand how I would use SnocketsAsset to concat multiple js files. The documentation says that for filename I should provide "A filename or list of filenames to be executed by the browser". But when I provide an array of filenames, I get a node error: Error: EISDIR, illegal operation on a directory.

Stylus compiler fails miserably

11 Feb 19:19:00 - [nodemon] starting `node app.js`

/Users/Max/Projects/mobota/node_modules/asset-rack/lib/asset.coffee:85
          throw error;
                ^
TypeError: /Users/Max/Projects/mobota/public/css/app.styl:5
   1| // @import './mixin'
   2| 
   3| body
   4|   background: #000
 > 5| 

Cannot read property 'length' of null

It looks like .render (error, css) => always throws an error. Hem from spinejs works with stylus fine though, so def not stylus problem

Add readme to Admin Page

/asset-rack/readme

Use the markdown library that's already in the project.

You can unescape html in jade like this:

!{html}

We'll need to convert this stuff:

The triple backtick syntax thing into:

<pre><code class="javascript">

etc.

Convert all files types of a given extension

Do you guys have the capability for something like "If you see a file with extension *.foo - automatically serve it at the url as the file with extension *.bar"?

Before I start writing my own junk I thought I'd ask you.

BrowserifyAsset watch is not working

I'm thrilled with asset-rack and getting fantastic results with StaticAssets and StylusAssets. However, watch: true is not working for BrowserifyAssets, even though it works correctly with StylusAssets. debug: true correctly gives me source maps with browserify, so I know options are being passed correctly.

I was previously using browserify-middleware https://github.com/ForbesLindesay/browserify-middleware , which correctly recompiled the browserify bundle on any change. I'm trying to get asset-rack to do the same. Using nodemon to reload my server is far slower than browserify-middleware was.

Thanks in advance for your help.

multi-node safety?

hello guys

asset-rack served me well so far with single-node projects but i have my doubts that it is safe enough when running multiple nodes (for a new project of mine). can you confirm?

  • michael

Can't make it work with i18n

Hi everyone,

I'm using asset-rack to serve Jade assets for my Backbone app :

i18n.configure
  locales  : ['en']
  register : global
  directory: 'config/locales'
  extension: '.json'

app.configure ->
  app.use i18n.init
  app.use new JadeAsset
    url    : '/backbone/templates.js'
    dirname: __dirname + '/app/assets/javascripts/app/templates'

Well it works perfectly but I can't use my i18n module as I did before in my Jade templates

b #{__('foo')}

Throws __ undefined. I'm using this module : https://github.com/mashpie/i18n-node

Any solution ?
Thanks :)

Snockets started acting funny since v2

#= require ../helpers.js
#= require app.utils.js

#= require router.coffee
#= require_tree models
#= require_tree collections
#= require_tree views

app = _.extend(@app, Backbone.Events)

# Precached DOM elements
app.dom = {}
app.dom.win = $(window)
app.dom.doc = $(document)
app.dom.html = $('html')
app.dom.body = $('body')
app.dom.screens = $('#l-screens')
app.dom.sidebar = $('.l-sidebar')
app.dom.content = $('.l-content')

app.dom.html.removeClass('no-js').addClass('js')
app.dom.html.addClass('opera')                                   if app.browser.isOpera
app.dom.html.addClass('firefox')                                 if app.browser.isFirefox
app.dom.html.addClass('ie ie' + app.browser.isIE)                if app.browser.isIE
app.dom.html.addClass('ios ios' + app.browser.isIOS)             if app.browser.isIOS
app.dom.html.addClass('android android' + app.browser.isAndroid) if app.browser.isAndroid

app.size = {}
setAppSize = ->
  app.size.width = app.dom.win.width()
  app.size.height = app.dom.win.height()
app.dom.win.on('resize', setAppSize)
setAppSize()

app.screens = new Swipe(app.dom.screens[0], startSlide: 1, callback: (event, index, elem)-> app.trigger('screenchange', index))
app.dom.sidebar.css(height: app.size.height)

app.router = new app.Router()
Backbone.history.start(pushState: true)

@app = app

is being cut off near line

  app.screens = new Swipe(app.dom.screens[0], startSlide: 1, callback: (event, index, elem)-> app.trigger('screenchange', index))

E.g. producing something like

app.screens = new Swipe(app.dom.screens[0], {
    startSlide: 1,
    callback: function(ev

Served with

new rack.SnocketsAsset(
  url: '/app.js'
  filename: __dirname + '/app/client/app.coffee'
  compress: false
)

[bug] Object #<Browserify> has no method 'addEntry'

i just did an npm update and with the latest asset-rack code my app can't run. here the whole stack:

Object #<Browserify> has no method 'addEntry'

    at BrowserifyAsset.exports.BrowserifyAsset.BrowserifyAsset.create (/home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/compiled/modules/browserify.js:48:13)
    at BrowserifyAsset.<anonymous> (/home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/compiled/asset.js:148:22)
    at BrowserifyAsset.EventEmitter.emit (events.js:92:17)
    at /home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/compiled/rack.js:66:22
    at iterate (/home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/node_modules/async/lib/async.js:108:13)
    at /home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/node_modules/async/lib/async.js:119:25
    at StylusAsset.<anonymous> (/home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/compiled/rack.js:64:18)
    at StylusAsset.EventEmitter.emit (events.js:92:17)
    at StylusAsset.<anonymous> (/home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/compiled/asset.js:113:19)
    at StylusAsset.EventEmitter.emit (events.js:95:17)
    at /home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/compiled/modules/stylus.js:76:24
    at Renderer.render (/home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/stylus/lib/renderer.js:81:5)
    at /home/michael.heuberger/projects/binarykitchen/code/videomail/node_modules/asset-rack/compiled/modules/stylus.js:55:53
    at fs.js:266:14
    at Object.oncomplete (fs.js:107:15)Object #<Object> has no method 'match'

any clues?

update dependency requirements

npm WARN unmet dependency /var/www/mobota/node_modules/asset-rack requires jade@'0.27.7' but will load
npm WARN unmet dependency /var/www/mobota/node_modules/jade,
npm WARN unmet dependency which is version 0.28.2
npm WARN unmet dependency /var/www/mobota/node_modules/asset-rack requires coffee-script@'1.4.0' but will load
npm WARN unmet dependency /var/www/mobota/node_modules/coffee-script,
npm WARN unmet dependency which is version 1.6.2

Would be awesome to update to the latest

url parameters when requesting static assets doesn't work

If you add a url parameter onto a static asset url, it doesn't serve the asset.

The Font Awesome library specifies the font asset urls like this:
http://localhost:3000/font/fontawesome-webfont.ttf?v=3.0.1

Which doesn't seem to work when using asset rack StaticAssets. The url
http://localhost:3000/font/fontawesome-webfont.ttf
works just fine however.

Can't get assets.url to show hash value

I know I have asset-rack installed correctly, because both https://localhost:4000/hello.txt and https://localhost:4000/hello-5eb63bbbe01eeed093cb22bb8f5acdc3.txt return "hello world". However, in my app.js below app.use(assets) I have console.log(assets.url('/hello.txt')) which results in undefined.

Could you please point me to some examples of using assets.url. I'm not able to replicate any of the examples in your tests https://github.com/techpines/asset-rack/search?q=assets.url&ref=cmdform and get assets.url to report back the hashed URL.

Thanks.

Detect asset change?

Hi (again :-),
Could you give me a tip on how I could implement a change detection of an asset?

Let's say I modify the livescript source, I want the javascript to be automatically regenerated next time page is reloaded (at least for development).

If it's not possible - it's no biggy, as Livescript interpreter has a "watch" feature - so I could run that during development - but would be nice to have everything in one place.

Assets undefined

!= assets.tag('/app.js') assets is not defined is shown in the browser

Setup

var assets = new rack.AssetRack([
    new rack.BrowserifyAsset({
        url: '/app.js',
        filename: __dirname + '/public/javascripts/app.js'
    }),
    new rack.JadeAsset({
        url: '/templates.js',
        dirname: __dirname + '/views'
    })
]);

assets.on('complete', function() {
    logger.info("static asset compilation complete");
    app.use(assets);  // that's all you need to do
});

Support for new less parser options

Less parser 1.4 accepts new options like yui-compress and line-numbers=TYPE
It would be nice to be able to pass those options to less parser. Specially line-number since it'll allow us to use source maps in chrome.

Also I would like to know how I can enable source maps for coffee script assets.

Gzip Compression

I've got a working version in the unstable master here.

Just want this issue here to remind me to publish out to npm after testing.

modularisation

#2, #3 and #4 could be achieved with external plugins similarly to the way grunt works, just need to provide instructions (also consider just using something like consolidate, https://github.com/visionmedia/consolidate.js for the template engine support).

You may even want to consider enabling this whole module as a grunt plugin itself… that would be cool

Are all dependencies necessary?

Forgive my naive question, but are all these dependencies necessary? (E.g. what if I don't use less?)

dependencies": {
        "browserify": "1.17.3",
        "snockets": "1.3.8",
        "uglify-js": "2.2.4",
        "async": "0.1.22",
        "pkgcloud": "0.6.6",
        "less": "1.3.3",
        "jade": "0.27.7",
        "mime": "1.2.7",
        "nib": "0.9.1",
        "stylus": "0.32.0",
        "underscore": "1.4.4",
        "coffee-script": "1.4.0",
        "markdown": "0.4.0"
    },

Serving Private Images from S3.

I want to use S3 to serve user's private images from s3. I know thats kind of possible. But what I want to how can I authenticate the user before serving him these images. One more thing I want to clarify regarding how assest-rack works. I want to know when the files are served from S3. Are they stored anywhere in the server(in my case it would be EC2). If they are stored in temporary files or something I would like to know.

Dependencies on compilers

Asset-rack should, I think, not be directly dependent on the assets compilers and libs like jade, nib, stylus, etc. but should use the libraries made available from the parent project. That way, the parent project is responsible of the compiler versions, not asset-rack, and can choose an earlier version of some libraries if there are compatibility issues; making the library much more flexible (this is made that way in connect-assets).

The actual changes would be:

  • to remove dependencies on asset compiler libraries;
  • to specify in the doc that the parent project have to include (in the package.json) the libraries needed (eg. if I am going to use rack.StylusAsset, I need to add the stylus dependency myself in my project using the lib).

hashed url for stylus assets doesn't work

I can access the output of my stylus file just fine if I navigate to /css/app.css, but if I use assets.tag or assets.url, it won't work (I get Cannot GET /css/app-a8c4e5f26745712564df2a8a9f6e1bf5.css).

Get compilation results on deplyment

Hi!

AssetRack is awesome for development, but I cannot figure a best way to get compiled results on deployment. I wanted to serve static assets with nginx and proxy all other requests to node. I see that AssetRack supports Amazon S3 and other cloud storages, but what if I want to serve resulting assets locally? Can you add a way to get compiled results for deployment, save them to a disk or something?

[feature] allow empty contents

hello guys

this might sound weird, but i have a special situation here where i'd like to set null for contents. at the moment this code works fine:

        // create special kind of settings for a json file that is hashed by its contents
        var settingsAsset = new rack.Asset({
            url:      '/j/app.settings.json?' + app.settings.hash,
            contents: ''
        });

        // overwrite respond: i need the req variable to build contents
        // (because my settings depend on user-agent in req) 
        settingsAsset.respond = function(req, res) {
            var contents = app.settings.filter(req);
            res.json(contents);
        };

you see, this is very special. i'm generating the real contents during the response() method. if i leave out contents: '' then i get a 404.

i think my above code isn't elegant but i see no other workaround. i want to be able to build the contents with the help of contents inside the response variable res.

any ideas?

Problem (typo?) in less.coffee

Trying asset-rack this evening and ran into the error below. Looks like a likely typo in the less.coffee file. I edited to @trigger rather than @tigger but that fails as well.

events.js:48
throw arguments[1]; // Unhandled 'error' event
^
TypeError: Object # has no method 'tigger'
at /Volumes/SATA/Development/projects/quotes/back/node_modules/asset-rack/lib/assets/less.coffee:40:26
at Object.parse (/Volumes/SATA/Development/projects/quotes/back/node_modules/asset-rack/node_modules/less/lib/less/parser.js:343:24)
at LessAsset.create (/Volumes/SATA/Development/projects/quotes/back/node_modules/asset-rack/lib/assets/less.coffee:38:23)
at /Volumes/SATA/Development/projects/quotes/back/node_modules/asset-rack/lib/index.coffee:57:24
at /Volumes/SATA/Development/projects/quotes/back/node_modules/async/lib/async.js:86:13
at Array.forEach (native)
at /Volumes/SATA/Development/projects/quotes/back/node_modules/async/lib/async.js:26:24
at Object.forEach (/Volumes/SATA/Development/projects/quotes/back/node_modules/async/lib/async.js:85:9)
at Array.0 (/Volumes/SATA/Development/projects/quotes/back/node_modules/asset-rack/lib/index.coffee:53:22)
at EventEmitter._tickCallback (node.js:190:38)

Does asset-rack work well on node 0.10.0?

Hello guys

I'm having issues here with asset-rack on my node app running on node 0.10.0 - when I disable asset-rack, it works.

When I do npm install asset-rack I see quite lots of warnings. No idea what the real problem is here.

Any clues?
Michael

assets.tag does not point to S3 resource

If you use this module to upload a resource to S3, subsequently calling assets.tag(resourceName) does not return a link tag with a href pointing to the s3 location where the resource was uploaded. The href always refers to a path relative to the current hostname (i.e., href="/css/cssResource.css" instead of href="https://s3.amazonaws.com/bucket_name/css/cssResource.css").

Weird link tag in HTML output

!=assets.tag('/app.css')

Produce

<link href="/app-1ad9d5c8b508398f116dc34827f8e17c.css" rel="stylesheet"></link>

Which is a wee bit invalid. Should be

<link href="/app-1ad9d5c8b508398f116dc34827f8e17c.css" rel="stylesheet">

instead.

Compiling Coffee on publish

Instead of going ahead with a PR, I decided to ask first.

A typical convention found in many modules,
is to put the coffee scripts in src (since they have
to be compiled), and then add to package.json:

  "scripts": {
    "publish": "coffee -o lib/ -c src/"
  }

And have coffee-script be a devDependencies entry.

That way, files get transparently compiled to lib in the
final published archive, among with the original CoffeeScript
files. It makes things simpler for anyone (no switch, no
run-time compiling, no coffee when not needed, etc.)

Would you agree to do this in asset-rack?

livescript?

Saw your post over on connect-assets.
So this look pretty cool.

Before giving it a go, a small how - is it possible to implement a processor for livescript?

if asset.checkUrl request.path

in Asset.handle, when dealing with a set of @assets why do we need to call checkUrl for each child asset?

What if I want my child assets to respond to different Urls than the bundled collection? I think this check is not necessary.

How to disable md5 in dev env?

How to disable md5 hash in dev env?

in jade

!= asset_tag ('/js/count_input_page.js')

I want to disable md5 hash on my local machine, as it causing problem to me.

asset.deploy unhandled exception

I'm getting an intermittent error deploying to Amazon S3. Seems they're hanging up on the connection and that's causing the following exception to show up:

... assets being listed ...
/images/icons/spinner.gif

events.js:71
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: write EPIPE
  at errnoException (net.js:770:11)
  at Object.afterWrite (net.js:594:19)

It happens with various files, none of them all that large, none all that small. Just a flakey
connection I suppose? Anyway, I've dug through asset-rack and pkgcloud looking for a way to catch this exception, and honestly I can't find a thing. I thought I'd document it here and
maybe if someone else encounters the same problem, it can get some attention.

For now, I'm just trying to deploy again, and eventually all the assets get uploaded. It's a
pain, but I'm not seeing a workaround.

Watch for Stylus / Jade templates doesn't work?

Would be very nice to have it working! And I mean client side precompiled into a variable frontend templates ofc. Having watch only for javascript is just teasing

This is my setup:

assets = new rack.AssetRack([
  new rack.StylusAsset(
    watch: true
    url: '/assets/app.css'
    filename: __dirname + '/css/app.styl'
    paths: [__dirname + '/css']
    compress: !config.debug
  )

  new rack.SnocketsAsset(
    url: '/assets/libs.js'
    filename: __dirname + '/app/client/libs.js'
    compress: !config.debug
    watch: config.debug
  )

  new rack.SnocketsAsset(
    url: '/assets/app.js'
    filename: __dirname + '/app/client/app.coffee'
    compress: !config.debug
    watch: config.debug
  )

  new rack.JadeAsset(
    url: '/assets/views.js'
    dirname: __dirname + '/views/client'
    separator: '_'
    clientVariable: 'app.templates'
    compress: !config.debug
  )
])

Stylus has loads of imports in app.styl, looks like you don't check for imports changes or something.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.