rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
541 stars 97 forks source link

No asset number and * not working #59

Closed chrisallick closed 11 years ago

chrisallick commented 11 years ago

the files are being inserted correctly, but there are no asset versions, i tried changing a file, but still not seeing any changes.

also, no wild cards were working /js/*.js did not work

//layout <%= css :all, :main %> <%= js :all, :main %>

//app set :root, File.dirname(FILE) register Sinatra::AssetPack

    assets {
        js :all , [
            '/js/jq.js',
            '/js/trash.js'
        ]

        js :main, [
            '/js/main/main.js',
            '/js/main/upload.js',
            '/js/main/urlize.js',
        ]

        css :all, [
            '/css/reset.css'
        ]

        css :main, [   
            '/css/main/main.css'
        ]

        js_compression  :jsmin
        prebuild true
    }

    get '/', :agent => /iPhone/ do
      erb :mobile, :locals => {
        :mobile => true,
        :js => "mobile.js",
        :css => "mobile.css",
        :uploaded_image => ""
      }  
    end

    get '/' do
        erb :main, :locals => {
            :mobile => false,
        }
    end
j15e commented 11 years ago

I have this issue on AppFog deployment, might be an issue with set :root, File.dirname(__FILE__) on AppFog environment? Have you found a fix?

j15e commented 11 years ago

Found out the problem : I was not deploying my source assets since I thought they were not necessary having compile them with rake assetpack:build before pushing my app with af update.

But this was causing the issue since the mtime of original source files are uses to generate the version number. If file are not present / mtime not found, no version number is appended.

See https://github.com/rstacruz/sinatra-assetpack/blob/master/lib/sinatra/assetpack/buster_helpers.rb#L28

chrisallick commented 11 years ago

I'll check that out. I ultimately bailed and switched to rails with a Sinatra app inside and devise for authentication. It's a very nice setup and hand-holdy transition to rails.

On Jan 5, 2013, at 1:53 PM, Jean-Philippe Doyle notifications@github.com wrote:

Found out the problem : I was not deploying my source assets since I thought they were not necessary having compile them with rake assetpack:build before pushing my app with af update.

But this was causing the issue since the mtime of original source files are uses to generate the version number. If file are not present / mtime not found, no version number is appended.

See https://github.com/rstacruz/sinatra-assetpack/blob/master/lib/sinatra/assetpack/buster_helpers.rb#L28

— Reply to this email directly or view it on GitHub.

j15e commented 11 years ago

Thanks for the update, I'll close this issue unless you may provide additional informations.