3

This should be pretty easy, but it's simply not working. Running Padrino with sinatra-assetpack. All css files serve perfectly like this:

serve '/stylesheets', from: '/app/stylesheets'
css :shared, [
  '/stylesheets/reset.css',
  '/stylesheets/runemadsen.css'
]

But when trying to serve .js files, it doesn't work. I get a 404 in the script load:

serve '/javascripts', from: '/app/javascripts'
js :shared, [
  '/javascripts/jquery.js'
]

I really don't get it. It's exactly the same code. The files are there. Any tips?

phillbaker
  • 1,518
  • 11
  • 22
Ronze
  • 1,544
  • 2
  • 18
  • 33

1 Answers1

0

Not sure of the issue, but can you get the basic approach working? The serve '/javascripts', from: '/app/javascripts' part is optional. From the Readme with just the javascript:

require 'sinatra/assetpack'

class App < Sinatra::Base
  set :root, File.dirname(__FILE__)
  register Sinatra::AssetPack

  assets {
    # The second parameter defines where the compressed version will be served.
    # (Note: that parameter is optional, AssetPack will figure it out.)
    js :app, '/js/app.js', [
      '/js/vendor/**/*.js',
      '/js/app/**/*.js'
    ]
  }
end

and for what is worth, my assets block looks like this:

  assets {
    js :main, [
      '/js/jquery.js',
      '/js/application.js',
    ]

With jquery located in public/js and application.coffee located in app/js. The script tag in my layout (haml) is =js :main.

philoye
  • 2,490
  • 28
  • 23