Git Product home page Git Product logo

sinatra-asset-pipeline's People

Contributors

allenan avatar alotofnoodles avatar awea avatar bajamircea avatar benmanns avatar bogdanrada avatar buonomo avatar danielspaniel avatar georges avatar jamiees2 avatar kalasjocke avatar khelll avatar kwbock avatar lepfhty avatar madwork avatar michaelfairley avatar msalzburg avatar olemchls avatar pbevin avatar plukevdh avatar rubycut avatar sobering avatar tomgi avatar toroidal-code avatar westonganger 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

sinatra-asset-pipeline's Issues

Basic readme config doesn't generate any resources

I've tried to follow the instructions in the README and none of my assets are being generated.

running the rake tasks also seems to do nothing, just generating an empty directory with an empty manifest file in it (just two curly brackets).

Both the js and css application files are pretty simple just a list of dependencies from bower, so I've added the bower directories with assets_path but again nothing is precompiled and nothing is served in development mode.

I'm probably doing something wrong but this was working pretty well but that was with 0.7.0.

Would appreciate any advice or help.

gist with my app.rb @ https://gist.github.com/stick/179bb9772b3a4d974bd76dc434cadb9c

Mounting inside of a rails app

I am trying to mount a Sinatra application inside of a Rails app. I'm havving issues with the assets. None of them are rendering. It is happen because rails wants to take over /images /stylesheets /js etc.
Is there a way of setting the asset path in the sinatra application?

Application name constant hard-coded

The constant App is currently hard-coded - maybe classic and differently named modular apps should be allowed to use this gem as well?

See for example lib/sinatra/asset_pipeline.rb, lines 24, 37, 38, 55.

Unable to get assets to serve in production

I'm trying to test the compiled assets by running the app in production but it's not serving anything now.

Below is the start of my application;

require 'bundler'
require 'sinatra/asset_pipeline'
Bundler.require(:default)
class Site < Sinatra::Base
  set :environment, ENV['RACK_ENV'].to_sym
  enable :sessions
  set :session_secret, 'foo'
  require './helpers'
  helpers SDS::SiteHelper
  register Sinatra::Partial
  enable :partial_underscores
  set :assets_precompile, %w(app.js.coffee app.sass *.png *.jpg *.svg *.eot *.ttf *.woff)
  register Sinatra::AssetPipeline

layout.haml;

!!! 5

%html
  %head
    %meta{"http-equiv" => "X-UA-Compatible", content: "IE=edge"}
    %meta{charset: "utf-8"}/
    %title= page_title
    %meta{name: "viewport", content: "width=device-width, initial-scale=1.0, user-scalable=1" }
    = surround '<!--[if !IE | gte IE 9]><! -->', '<!--<![endif]-->' do
      %link{rel: "stylesheet", href: "#{stylesheet_path 'app'}", data: {'skrollr_stylesheet' => ''}}
    /[if IE 8]
      %link{rel: "stylesheet", href: "#{stylesheet_path 'app.ie8'}", data: {'skrollr_stylesheet' => ''}}
    -# Modernizr 2.8.3 (Custom Build) | MIT & BSD
    -# Build: http://modernizr.com/download/#-svg-cssclasses
    %script= File.read( File.join(settings.root,'assets/javascripts/vendor/modernizr.min.js'))
    = font_tracker

  %body
    #masthead
      #logo Skills Development Scotland

    = yield

    = partial "footer"

    %script{src: "#{javascript_path 'app'}"}

The public dir -
screen shot 2015-09-21 at 15 33 48

and console output -
screen shot 2015-09-21 at 15 40 45

I'm not sure where I've gone wrong with this.

Unable to generate assets

Forgive me for my naivety but I am unable to get even the example Sinatra app in the readme to precompile assets via the rake task. I have created what I believe to be the simplest possible sinatra app based off the example here:

https://github.com/incorvia/sinatra_sprockets_test

When either running...

bundle exec rake assets:precompile
RAKE_ENV=production bundle exec rake assets:precompile

...from the project root, nothing is generated inside the public directory.

Is there something I'm doing wrong?

No minification in staging environment

The gem does not set up minification of CSS or JS through sprockets except in the production environment. I think many would argue that a staging environment should closely match production and would thus have minification enabled. This should probably be documented somewhere in the readme if this is the expected behavior.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Assets not loaded

I'm just update gem from 0.7.0 to 1.0.x, the application.js and application.css is not loaded.
And when I try to precompile assets, the application.js and application.css is not in precompiled folder public/assets/

This is the error in console browser
Refused to execute script from 'http://localhost:9292/javascripts/application.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Investigate/Update for Sprockets 4

This gem has locked Sprockets to 3.x. Sprockets 4 brings es6 support and sourcemaps, so it's a nice update. Would love to see this gem compatible!

Assets aren't precompiled when running precompile task or deploying to Heroku

I'm attempting to use sinatra-asset-pipeline in a Sinatra app which will be deployed with Heroku (although ideally I'll ultimately use a CDN* to host assets); when I run the RACK_ENV=production bundle exec rake assets:precompile task locally no files are generated; only a manifest-<MD5>.json is created, which contains just an empty set of braces.

When deploying on Heroku I do see that the precompile task runs, but the associated generated asset paths remain 404s:

-----> Precompiling assets
       Running: rake assets:precompile
       Asset precompilation completed (0.96s)

My test application's repository can be found here, and I've deployed it on Heroku here.

I have two questions:

  1. When deploying with Heroku (which their own docs suggests should be possible) should the precompile task be generating files within Heroku's own cache?
  2. When running the precompile task locally, should a set of production-ready asset files not be generated? If not, how can we supply assets to a CDN? I was considering using asset_sync to do this, but I'm probably getting ahead of myself with that…

*In my testing, when I specify a CDN hostname with set :assets_host it made no difference to the paths generated in the Sinatra application in the staging environment β€” is this setting only used when the application is in the production environment?

Support for precompiling relative URL root

Any chance for supporting something like rake assets:precompile RAILS_RELATIVE_URL_ROOT=/app in Rails? I have an app I need to deploy not at the top level domain and can't seem to find a way to make it work with this gem.

Can't make the link between precompiled' assets

Hi,
I can't make it work in production, whereas it works ok in development

This is how my assets are organized:
capture d ecran 2014-11-26 a 15 12 42

In local dev env, the assets are precompiled in public/assets/ (with rake assets:precompile)
capture d ecran 2014-11-26 a 15 15 59
In Prod env, the capistrano task is configured this way:

  after 'deploy:finishing', :finalize_update do
    on roles(:web), in: :sequence do
      execute(:chmod, '-R g+w', release_path) if fetch(:group_writable, true)

      within release_path do
        execute :rake, "assets:precompile RACK_ENV=production"
        execute :rake, "assets:clean RACK_ENV=production"
      end
    end
  end

Sinatra app (let say myapp.rb)

# encoding: utf-8
require 'sinatra'
require 'haml'
require 'sass'
require 'compass'
require 'bootstrap-sass'
require 'sinatra/asset_pipeline'

Bundler.require

class MyApp < Sinatra::Base
  set :assets_prefix, %w(assets vendor/assets)
  set :assets_precompile, %w(app.js app.css *.png *.jpg *.svg *.eot *.ttf *.woff)
  register Sinatra::AssetPipeline

  ...

app.css

*= require application

application.scss

@import "bootstrap/variables";
@import "bootstrap/mixins";
...
...
@import "layout";

Layout:

    %link{ href: '/assets/application.css', rel: 'stylesheet' }

    ...

    %script{ src:'//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'}
    %script{ src: '//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js' }
    %script{ src: '/assets/app.js' }

Rakefile:

require 'sinatra/asset_pipeline/task'
require './lib/myapp'
Sinatra::AssetPipeline::Task.define! Novagile

But when I deploy in production something goes wrong, it does precompile but the CSS are not loaded.
Thus I have a html page with some JS, but NO images, NO CSS.

Am I missing something simple and obvious or is it a vicious config trick ? :'(

referenced here: https://stackoverflow.com/questions/27152533/sinatra-asset-pipeline-cant-use-link-to-precompiled-css

Sprockets 3.x support

Is upgrading to Sprockets 3.x possible? There's some cool stuff like sprockets-es6 that only works with 3.x.

Support for vendored assets manifest?

I usually find I have application related assets which change frequently, and vendor assets which change very rarely. In Rails, I compile these to separate manifest files with the following line:

config.assets.precompile += %w( vendor.js )

Is it possible to syntax this with sinatra-asset-pipeline? Having read the source code, it seems to be hardcoded to a single manifest with assets defined in /assets.

Opal issues.

I'm trying to use sinatra-asset-pipeline with Opal, unfortuently my app.js.rb's first require statement seems to be overridden by Sprockets (giving a file not found error), is this a sinatra-asset-pipeline issue, or something else? Repo is at http://github.com/zackp30/sinatra-base .

support for multiple asset dirs

I would like to have assets in /assets (which is default) plus /vendor/assets similarly as explained here: http://guides.rubyonrails.org/asset_pipeline.html#manifest-files-and-directives

I did hack like this:

  set :assets_precompile, %w[*.js]
  set :digest_assets, true
  register Sinatra::AssetPipeline
  configure do
    sprockets.append_path File.join(root, 'vendor', 'assets', 'components')
    sprockets.append_path File.join(root, 'vendor', 'assets', 'javascripts')
    sprockets.append_path File.join(root, 'vendor', 'assets', 'stylesheets')
  end

This partially works, but I can no longer precompile assets with rake task.

specs not serving assets in Rack::Test get request style tests

This is a great gem .. hands down. Worked as expected the first time .. except for one thing, in my tests.

Its a mystery to me why you would not do this:

app.configure :development, :test do
  app.get '/assets/*' do |key|
    key.gsub! /(-\w+)(?!.*-\w+)/, ""
    asset = app.sprockets[key]
    content_type asset.content_type
    asset.to_s
  end
end

ie. configure development AND test environment to get assets dynamically.
right now the code in the gem is only set to development. Like so:

app.configure :development  do
  app.get '/assets/*' do |key|
    key.gsub! /(-\w+)(?!.*-\w+)/, ""
    asset = app.sprockets[key]
    content_type asset.content_type
    asset.to_s
  end
end

I noticed someone wrote they thought it was a good idea to precompile the assets for testing.
How is that a good idea? I want dynamic assets in testing.

Want me to write a failing test for this case?

Asset folders not found if app is mounted in a different directory

Thanks for a great gem! I had a specific case where I'm mounting multiple apps in a config.ru file in a different directory to the application that is using the pipeline eg.

config.ru
web/app.rb
web/assets/*
api/app.rb

in config.ru I have:

map '/' do
  run My::Web
end

map '/api' do
  run My::API
end

The web app is using the pipeline gem but by default it doesn't find the assets folder(s).

I made a quick fix on my fork that fixes the problem for me, and it seems to work in the standard case where the config.ru is in the same folder as the app:

793e7e9

Cheers.

Asset with - in their name

I got an undefined method 'content_type' for nil:NilClass when I have some assets with an - in their name, I have only tested in development for now.

It's related to this :

# asset_pipeline.rb
app.configure :test, :development do
  app.get '/assets/*' do |key|
    key.gsub! /(-\w+)(?!.*-\w+)/, ""
  [..]

I understand what it does but I doesn't understand why. Can someone explain this to me ? I have updated the spec with that problem and I make them pass when I remove this gsub.

I'm missing something somewhere or what ? ^^

Assets Doesn't load when upgraded from Ruby 1.9.3 to Ruby 2.4.3

Hi,
I have a Sinatra application where I have upgraded from ruby 1.9.3 to ruby 2.4.3, after the upgrade assets are failing to load

22:25:32 application.1 | 10.191.228.114 - - [25/Mar/2018:22:25:32 -0700] "GET /assets//stylesheets/sso.css HTTP/1.0" 404 9 0.0076

22:25:32 application.1 | 10.191.228.114 - - [25/Mar/2018:22:25:32 -0700] "GET /assets//javascripts/login.js HTTP/1.0" 404 9 0.0061

22:25:32 application.1 | 10.191.228.114 - - [25/Mar/2018:22:25:32 -0700] "GET /assets//javascripts/login.js HTTP/1.0" 404 9 0.0079

Below is the code, please correct me if I am doing anything wrong here.
Javascripts and Stylesheets are in app/assets/

require 'sinatra/base'
require 'sprockets'
require 'sprockets-helpers'
require 'sinatra/asset_pipeline'
require 'compass'

helpers Sprockets::Helpers

set :app_root, File.expand_path(File.dirname(__FILE__)+"/../../")
set :public_folder, File.join(app_root + "/public")
assets = %w(login.js sso.css *.png *.jpg *.gif views/invitations/signup_form.js)
locale_files = Dir[File.join(app_root, 'config', 'locales', '*.yml')]

set :scss,                  {:style => :compact, :debug_info => true}
set :assets_precompile,     assets
set :assets_paths,          %w(app/assets vendor/assets)
set :assets_prefix,         %w(app/assets vendor/assets)
set :assets_css_compressor, :sass
set :assets_js_compressor, :uglifier
set :session_secret, "something secret, something safe"

register Sinatra::AssetPipeline

NOTE: The same above configuration works perfectly fine with ruby 1.9.3

In Gemfile:

gem "sinatra", '~>1.4'
gem "sprockets", '~>3.6'
gem 'sprockets-helpers', '~>1.1'
gem 'sinatra-asset-pipeline', '~> 1.0.1'
gem 'uglifier'
gem 'sass', '~>3.4.22'

Thanks In Advance

Debugging with digests disabled and expand on.

I tweaked sprockets-helpers for debugging by enabling expansion and disabling digest.

        Sprockets::Helpers.configure do |config|
            config.expand = true
            config.digest = false
            config.manifest = false
        end

I now get this error when I have an asset with a dash in the path. There needs to be a check for Sprockets::Helpers.digest==false when applying the regular expression.

127.0.0.1 - - [11/Apr/2013 22:39:33] "GET /assets/rangy-core.js?body=1 HTTP/1.1" 500 245840 28.5091
NoMethodError - undefined method `content_type' for nil:NilClass:
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-asset-pipeline-0.2.0/lib/sinatra/asset_pipeline.rb:51:in `block (2 levels) in registered'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1414:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1414:in `block in compile!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `[]'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (3 levels) in route!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:960:in `route_eval'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (2 levels) in route!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:981:in `block in process_route'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `catch'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `process_route'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:943:in `block in route!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `each'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `route!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1053:in `block in dispatch!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1050:in `dispatch!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `block in call!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `call!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:864:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/rack.rb:16:in `block in call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/interception-0.3/lib/interception.rb:71:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/interception-0.3/lib/interception.rb:71:in `listen'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/core_ext.rb:74:in `enable_rescuing!'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/core_ext.rb:94:in `with_rescuing'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/core_ext.rb:15:in `block (2 levels) in rescue'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/core_ext.rb:13:in `catch'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/core_ext.rb:13:in `block in rescue'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/core_ext.rb:12:in `loop'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/core_ext.rb:12:in `rescue'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/pry-rescue-1.1.0/lib/pry-rescue/rack.rb:16:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/showexceptions.rb:21:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:172:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1947:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `block in call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1693:in `synchronize'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/lint.rb:49:in `_call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/lint.rb:37:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/showexceptions.rb:24:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-1.4.2/lib/sinatra/base.rb:209:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/chunked.rb:43:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-websocket-0.3.0/lib/sinatra-websocket/ext/thin/connection.rb:26:in `pre_process_with_websocket'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/thin-1.5.1/lib/thin/connection.rb:54:in `process'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/thin-1.5.1/lib/thin/connection.rb:39:in `receive_data'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-websocket-0.3.0/lib/sinatra-websocket/ext/thin/connection.rb:40:in `receive_data_with_websocket'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-websocket-0.3.0/lib/sinatra-websocket/ext/thin/connection.rb:68:in `receive_data_with_flash_policy_file'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/thin-1.5.1/lib/thin/server.rb:159:in `start'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/bin/rackup:19:in `load'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/bin/rackup:19:in `<main>'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
    /home/rice/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'

Frame number: 0/58
Frame type: lambda

From: /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-asset-pipeline-0.2.0/lib/sinatra/asset_pipeline.rb @ line 51 self.HEAD /assets/*:

    46: 
    47:       app.configure :development do
    48:         app.get '/assets/*' do |key|
    49:           key.gsub! /(-\w+)(?!.*-\w+)/, ""
    50:           asset = app.sprockets[key]
 => 51:           content_type asset.content_type
    52:           asset.to_s
    53:         end
    54:       end
    55:     end
    56: 

NoMethodError: undefined method `content_type' for nil:NilClass
from /home/rice/.rvm/gems/ruby-1.9.3-p392/gems/sinatra-asset-pipeline-0.2.0/lib/sinatra/asset_pipeline.rb:51:in `block (2 levels) in registered'

Thanks!

Using absolute path in assets_prefix array

Hello,

I've met a little problem with using absolute paths during assets_prefix configuration.

        app.assets_prefix.each do |prefix|
          paths = Dir[File.join(app.root, prefix, '*')]
          paths.each { |path| app.sprockets.append_path path }
        end

In case when absolute path was used, paths variable wouldn't be populated properly.

What do you think, should this issue be fixed with detecting prefix to be absolute or not?

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.