Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
I';我在使用Sinatra,我的资产(sass)在heroku上不起作用_Heroku_Sass_Sinatra - Fatal编程技术网

I';我在使用Sinatra,我的资产(sass)在heroku上不起作用

I';我在使用Sinatra,我的资产(sass)在heroku上不起作用,heroku,sass,sinatra,Heroku,Sass,Sinatra,我的资产在我的本地机器上开发时运行良好。但是,当我部署到Heroku时,这些样式不起作用。为了让我的资产在Heroku上运行,我需要做什么 . ├── Gemfile ├── Gemfile.lock ├── codekit-config.json ├── config.ru ├── development.db ├── main.rb ├── public │   ├── assets │   │   ├── css │   │   │   ├── styles.css │   │   │  

我的资产在我的本地机器上开发时运行良好。但是,当我部署到Heroku时,这些样式不起作用。为了让我的资产在Heroku上运行,我需要做什么

.
├── Gemfile
├── Gemfile.lock
├── codekit-config.json
├── config.ru
├── development.db
├── main.rb
├── public
│   ├── assets
│   │   ├── css
│   │   │   ├── styles.css
│   │   │   └── styles.scss
│   │   ├── images
│   │   │   ├── logo.png
│   │   │   └── sinatra.jpg
│   │   ├── js
│   │   └── sass
│   └── favicon.ico
├── song.rb
└── views
    ├── about.haml
    ├── contact.haml
    ├── edit_song.haml
    ├── home.haml
    ├── layout.haml
    ├── login.haml
    ├── nav.haml
    ├── new_song.haml
    ├── not_found.haml
    ├── show_song.haml
    ├── song_form.haml
    └── songs.haml
7个目录,24个文件

main.app config.ru
。可以预编译资产(通过或其他方式),并将其签入然后推送,也可以使用您自己的资产。

谢谢,我非常感谢!。但我听说,如果您有
rake资产:precompile
任务,它将在推送时运行。对于CoffeeScript,我得到了一个错误。这是我得到的错误,这是一个Sinatra应用程序。顺便说一句,想知道如何克服它。@ZiyanJunaideen使用链轮
require 'sinatra/flash'
require 'sinatra'
require './song'
require 'sass'
require 'haml'
require 'sinatra/assetpack'

register Sinatra::AssetPack
# I dont' think I need the line below if I use codekit
# get('assets/css/styles.css') { scss :styles}

configure :development do
  DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/development.db")
end

configure :production do
  DataMapper.setup(:default, ENV['DATABASE_URL'])
end

assets do

  js :application, [
    '/js/jquery.js',
    '/js/app.js'
    # You can also do this: 'js/*.js'
  ]

  css :application, [
    '/assets/css/styles.css',
    '/assets/css/styles.scss',
   ]

  js_compression :jsmin
  css_compression :sass

end
configure do
  enable :sessions
  set :username, 'frank'
  set :password, 'sinatra'
end

helpers do
  def set_title
    @title ||= "Songs By Russell"
  end


end

before do
  set_title
end

get '/login' do
  haml :login
end

post '/login' do
  if params[:username] == settings.username && params[:password] == settings.password
    session[:admin] = true
    redirect to('/songs')
  else
    haml :login
  end
end

get '/logout' do
  session.clear
  redirect to('/login')
end

get '/set/:name' do
  session[:name] = params[:name]
end

get '/' do
  haml :home
end

get '/about' do
  @title = "All About This Website"
  haml :about
end

get '/contact' do
  haml :contact
end

post '/contact' do
  send_message
  flash[:notice] = "Thank you for your message. We'll be in touch soon."
end

not_found do
  haml :not_found
end
require './main'
run Sinatra::Application