Use sprockets 2.0 on both local and prod (php)environments with minimal hassle
While I recognize the dependency handling of sprockets is awesome, I have little knowledge on how to use it properly to make it meet my needs. I'm actually working on a php 5.3 application (lithium framework powered #li3), and I'm beginning the development of a public javascript file meant to send request to our servers and build DOM snippets with the results. Basically, I'm willing to keep my sources organized in modules, each dedicated to one task (ajax request, json parsing, DOM generating etc...), and feel the urge to use sprockets.
BUT how could sprockets be nicelly and somehow transparently integrated to my workflow (I want to avoid CLI tasks every time I modify one of my files) on my local env. ?
I'm sure this is somehow possible, but my knowledge of sprockets doesn't allow me to discover this by myself.
Have been exprimenting 开发者_StackOverflow中文版with the same problematics ? How could this be solved ? Thanks
Generally on your local environment you'll run sprockets as a web server. Generally that will involve adding a config.ru
file in you app with something like
require 'sprockets'
map '/assets' do
environment = Sprockets::Environment.new
environment.append_path 'app/assets/javascripts'
environment.append_path 'app/assets/stylesheets'
run environment
end
and run it with rackup config.ru
. This should reload your assets every time you change them.
精彩评论