rstacruz / sinatra-assetpack

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

Don't know how to build task 'assetpack:precompile' #192

Closed ajbeach2 closed 9 years ago

ajbeach2 commented 9 years ago

I am getting this error:

rake assetpack:precompile 
rake aborted!
Don't know how to build task 'assetpack::precompile'

These are the files of my sinatra app. I am not sure what is up because I am following the documentation in the README Gemfile:

source 'https://rubygems.org'
ruby '2.2.0'

gem 'haml'
gem 'sinatra', :git => 'git@github.com:sinatra/sinatra.git'
gem 'rack'
gem 'rack-recaptcha'
gem 'pony'
gem 'json'
gem 'sinatra-assetpack', :git => 'git@github.com:rstacruz/sinatra-assetpack.git'
gem 'closure-compiler'
gem 'sass'
gem 'tilt', '~>1.4.1'

group :development do 
    gem 'pry'
end

application.rb

require 'bundler'
Bundler.require

class Beach < Sinatra::Base
  set :root, File.dirname(__FILE__) 
  # set :protection, true

  register Sinatra::AssetPack

  set :assets_precompile, %w(app.js app.css *.png *.jpg *.svg *.eot *.ttf *.woff)

  assets do
    serve '/js',     from: 'app/js'        # Default
    serve '/css',    from: 'app/css'       # Default
    serve '/images', from: 'app/images'    # Default

    # The second parameter defines where the compressed version will be served.
    # (Note: that parameter is optional, AssetPack will figure it out.)
    # The final parameter is an array of glob patterns defining the contents
    # of the package (as matched on the public URIs, not the filesystem)
    js :app, '/js/app.js', [
      '/js/vendor/**/*.js',
      '/js/lib/**/*.js'
    ]

    css :application, '/css/application.css', [
      '/css/screen.css'
    ]

    js_compression :closure
    css_compression :sass
  end

  get '/' do
    haml :index
  end

  post '/email' do
    content_type :json
    headers 'Access-Control-Allow-Origin' => '*',
            'Access-Control-Allow-Methods' => ['POST']

    { :message => 'email_sent' }.to_json
  end

  get '/:path' do
    status 404
    "404"
  end

  run! if app_file == $0
end

Rakefile

APP_FILE  = 'application.rb'
APP_CLASS = 'Beach'

require 'sinatra/assetpack/rake'
ajbeach2 commented 9 years ago

nvm im an idiot

edmundtfy commented 7 years ago

I have the same problem...