asset-pipeline

Rails 3.1, exclude JS files from asset pipeline

梦想与她 提交于 2019-12-06 22:28:08
问题 I know there are a million questions already on this, but I can't get this. I want to include most of my JS files in the asset pipeline, but I have a few I want to load conditionally (or only on certain pages). These are big, complicated files and will never, ever be used by 95% of the users, so I'd rather not have them loaded for every user. One set of JS files is for a calendar, placed in: app/assets/javascripts/calendar So my manifest is set up to include only the top directory (and

What does changing config.assets.version number do?

久未见 提交于 2019-12-06 22:02:36
问题 What does changing config.assets.version number do? I understand that the assets expire (as it is written in the comments) but what does it do in the background? would it delete all the compiled assets? or does it take that version number and uses it somewhere else? 回答1: It will precompile assets with another fingerprints (the code appendend to the file name), making all the client's browsers download the files again. In other words, as you said, it expires the caches in the client's browsers

Javascript manifest file “application.js” is not processed

隐身守侯 提交于 2019-12-06 21:52:22
问题 I am on a Macbook Pro and I created a new Rails 3.2 app, but the assets pipeline does not work. Here is what I did: $ rails version Rails 3.2.5 $ rails new test_assets $ cd test_assets $ rails server The server is started OK, but if I visit http://0.0.0.0:3000/assets/application.js , it turns out the manifest file is not processed at all, it shows: //... some comments ... //= require jquery //= require jquery_ujs //= require_tree . ; I tried to do the exactly the same steps on my other

asset pre compilation for subdirectory manifest file

核能气质少年 提交于 2019-12-06 21:49:37
问题 I am using Rails 3.1 and under assets I have files like this: assets javascripts admin admin.js a1.js client client.js c1.js admin.js looks like this // //= require jquery //= require jquery_ujs //= require a1 client.js looks like this // //= require jquery //= require c1 Everything works fine in development mode. When I do rake assets:precompile then I do not see any javascript files in public/assets. I do see all the stylesheets in public/assets. I think this has to do with the fact that

What are the pros and cons of Asset-Pipeline/Turbolinks from Rails 4 for a big application? [closed]

余生颓废 提交于 2019-12-06 19:47:13
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . We're working on a pretty big and wide application. The website will have a lot of different sections with some very different user

Rails Minified (Compiled) Assets in development mode

只谈情不闲聊 提交于 2019-12-06 18:44:48
问题 How do I get my assets rendered in their minified (compiled) form in Rails development mode? I have about few dozens of asset files, and because they are served one after another it all takes pretty long before the page loads in development. I believe if I keep them compiled and getting served from that would speed up my page load time(I know this is not ideal when I am specifically working on assets). Here is my style and script tags in the layout <%= stylesheet_link_tag 'all' %> <%=

Why won't Rails find my assets?

对着背影说爱祢 提交于 2019-12-06 18:43:46
问题 When in production mode, rails can't seem to find any precompiled assets from the asset pipeline. I'm using rails 3.2.0 and ruby 1.9.3 running inside RVM on CentOS. No additional web server is running in conjunction with this application. The application was only recently updated to use the asset pipeline, as it was originally a rails 3.0 app. After running rake assets:clean rake assets:precompile I see the hashed content in public/assets, as I would expect. The hashes at the end of the files

Rails 3.1 assets:precompile Connecting to Database

耗尽温柔 提交于 2019-12-06 16:00:00
I'm trying to deploy an application to Heroku after upgrading to Rails 3.1 with the asset pipeline. I ran into the common issue mentioned on Heroku's troubleshooting page when receiving the error: could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port xxxx? I took the suggestions on the page and added the following to my config/application.rb file (after also trying to add it to the individual [environment].rb files to no effect) config.assets.initialize_on_precompile = false I've modified my database.yml file to point

Putting Javascript at the end of the file using Rails 3.1 asset pipeline

旧时模样 提交于 2019-12-06 15:39:14
Sometimes in heavy client side Javascript we put the tags at the end of the HTML file so that the content is displayed first while Javascript is loaded afterwards. Is it possible to do this using Rails 3.1 assets pipeline? EDIT: <html> <head> <%= javascript_include_tag "application" %> </head> <body> <!-- all the page content goes here --> <!-- we include these at the bottom to ensure the html loads first and the javascript is loaded afterwards. How can we achieve this through rails asset pipelining? --> <script src="/some_other_assets/first_file.js"></script> <script src="/some_other_assets

run rake task inside rails application

梦想的初衷 提交于 2019-12-06 13:53:42
I want to run asset precompile task inside the rails application,As I had many dependencies who will change the code,in that case all the time whenever they change i need to run the script as I cant give server access to them so I am providing the GUI for them from that they alone can run the script,so,I have built UI to run the task with some parameter like system("Template='#{params[:template]}' Theme='#{params[:theme]}' rake assets:precompile) I am getting two values from UI(params[:template],params[:theme]).Another thing i want to run this task in another path(site path) means Admin side