Farukh D.M
2013-Jul-11 11:24 UTC
Asset Pipeline: Asset attempted to compress while creating page response & not during asset request
Hi, I am stuck in a weird situation where in my production environment, an asset is being attempted to compress while rendering a view. I''ve all my assets put into public/assets folder via rake "assets:precompile" production.rb has following configurations: -------------------------------------------------------------- # Disable live compilation of assets(Don''t fallback to assets pipeline if a precompiled asset is missed) config.assets.compile = false # Assets pre-compilation task(rake assets:precompile) configurations config.assets.css_compressor = :yui config.assets.js_compressor = :yui config.assets.compress = true When I request for some page let say http://www.example.com/home, while generating the page response, Rails is trying to compress an asset named "jquery.bxslider.min" I''ve following code that is creating error. <%= content_for :js_include do %> <%= javascript_include_tag ''jquery.bxslider.min'' %> <% end %> Error in log: ============ActionView::Template::Error (undefined method `exitstatus'' for nil:NilClass (in /example/lib/assets/javascripts/jquery.bxslider.min.js)): 57: <%= content_for :js_include do %> 58: <%= javascript_include_tag ''jquery.bxslider.min'' %> 59: <% end %> The error is however for missing java(as I''m using YUI for compression, which depends on java) I don''t want any live compression & compilation, as assets are already available in public/assets folder I am surprised, why Rails is trying to compress asset while rendering an action. Please advise. Regards Farukh D M -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f6292c48-66cd-46f9-b6d3-fb9b1e005c9f%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
mike
2013-Jul-11 16:28 UTC
Re: Asset Pipeline: Asset attempted to compress while creating page response & not during asset request
On Thursday, July 11, 2013 7:24:34 AM UTC-4, farukhdm wrote:> > Hi, > > I am stuck in a weird situation where in my production environment, an > asset is being attempted to compress while rendering a view. > I''ve all my assets put into public/assets folder via rake > "assets:precompile" > > production.rb has following configurations: > -------------------------------------------------------------- > # Disable live compilation of assets(Don''t fallback to assets pipeline if > a precompiled asset is missed) > config.assets.compile = false > > # Assets pre-compilation task(rake assets:precompile) configurations > config.assets.css_compressor = :yui > config.assets.js_compressor = :yui > config.assets.compress = true > > > When I request for some page let say http://www.example.com/home, while > generating the page response, Rails is trying to compress an asset named > "jquery.bxslider.min" > > I''ve following code that is creating error. > > <%= content_for :js_include do %> > <%= javascript_include_tag ''jquery.bxslider.min'' %> > <% end %> > > Error in log: > ============> ActionView::Template::Error (undefined method `exitstatus'' for nil:NilClass > (in /example/lib/assets/javascripts/jquery.bxslider.min.js)): > 57: <%= content_for :js_include do %> > 58: <%= javascript_include_tag ''jquery.bxslider.min'' %> > 59: <% end %> > > > The error is however for missing java(as I''m using YUI for compression, which depends on java) > > I don''t want any live compression & compilation, as assets are already available in public/assets folder > > > I am surprised, why Rails is trying to compress asset while rendering an action. > > > Please advise. > > > Regards > > Farukh D M >I''m not surprised it is re-compiling the source code at runtime. You have to be careful with javascript_include_tag when you are using the asset pipeline. When you precompile your assets, everything is put into one js file with a long, cryptic name that looks something like the following in html: <script src="/assets/application-931a21730f0f60d50be598cdd891dccf.js"></script> When you then insert a javascript tag, it''s going to look like the following in your html: <script src="jquery.bxslider.min.js"></script> The browser is going to attempt to load both files. It doesn''t detect that the contents of jquery.bxslider.min.js are actually already in the first file. Because this file is located in the /app/assets/js directory, it''s going to be processed by rails through the asset compiler when the browser requests the file. You shouldn''t reference a javascript file in a script tag if you''ve already included it in the asset pipeline unless you truly intend to load it twice. If you have javascript you want to load independent of the asset pipeline and you don''t want it processed through the asset compiler, you should reference it in a javascript_include_tag as you have done above, but you should locate the file in the public/js directory. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9720da6d-ed91-4517-9290-f09debc2d8d3%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
farukhdm
2013-Jul-12 05:22 UTC
Re: Asset Pipeline: Asset attempted to compress while creating page response & not during asset request
Thanks for the update. jquery.bxslider.min.js in my case is not part of application.js I have added jquery.bxslider.min.js to pre-compile path also, so that it can be loaded independently. Its available in public/assets folder too. You said "I''m not surprised it is re-compiling the source code at runtime."..I totally agree. However that should happen when browser request that very particular asset, not while creating page response that has <script src="jquery.bxslider.min.js"></script> in the markup. Am I going astray here in making you understand the issue. Let me know. On Thursday, 11 July 2013 21:58:03 UTC+5:30, mike wrote:> > > > On Thursday, July 11, 2013 7:24:34 AM UTC-4, farukhdm wrote: >> >> Hi, >> >> I am stuck in a weird situation where in my production environment, an >> asset is being attempted to compress while rendering a view. >> I''ve all my assets put into public/assets folder via rake >> "assets:precompile" >> >> production.rb has following configurations: >> -------------------------------------------------------------- >> # Disable live compilation of assets(Don''t fallback to assets pipeline >> if a precompiled asset is missed) >> config.assets.compile = false >> >> # Assets pre-compilation task(rake assets:precompile) configurations >> config.assets.css_compressor = :yui >> config.assets.js_compressor = :yui >> config.assets.compress = true >> >> >> When I request for some page let say http://www.example.com/home, while >> generating the page response, Rails is trying to compress an asset named >> "jquery.bxslider.min" >> >> I''ve following code that is creating error. >> >> <%= content_for :js_include do %> >> <%= javascript_include_tag ''jquery.bxslider.min'' %> >> <% end %> >> >> Error in log: >> ============>> ActionView::Template::Error (undefined method `exitstatus'' for nil:NilClass >> (in /example/lib/assets/javascripts/jquery.bxslider.min.js)): >> 57: <%= content_for :js_include do %> >> 58: <%= javascript_include_tag ''jquery.bxslider.min'' %> >> 59: <% end %> >> >> >> The error is however for missing java(as I''m using YUI for compression, which depends on java) >> >> I don''t want any live compression & compilation, as assets are already available in public/assets folder >> >> >> I am surprised, why Rails is trying to compress asset while rendering an action. >> >> >> Please advise. >> >> >> Regards >> >> Farukh D M >> > > I''m not surprised it is re-compiling the source code at runtime. You have > to be careful with javascript_include_tag when you are using the asset > pipeline. When you precompile your assets, everything is put into one js > file with a long, cryptic name that looks something like the following in > html: > > <script > src="/assets/application-931a21730f0f60d50be598cdd891dccf.js"></script> > > When you then insert a javascript tag, it''s going to look like the > following in your html: > > <script src="jquery.bxslider.min.js"></script> > > The browser is going to attempt to load both files. It doesn''t detect > that the contents of jquery.bxslider.min.js are actually already in the > first file. Because this file is located in the /app/assets/js directory, > it''s going to be processed by rails through the asset compiler when the > browser requests the file. > > You shouldn''t reference a javascript file in a script tag if you''ve > already included it in the asset pipeline unless you truly intend to load > it twice. > > If you have javascript you want to load independent of the asset pipeline > and you don''t want it processed through the asset compiler, you should > reference it in a javascript_include_tag as you have done above, but you > should locate the file in the public/js directory. > > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/629a2444-45f2-41b8-826e-7ef6864d31a4%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
farukhdm
2013-Jul-12 06:07 UTC
Re: Asset Pipeline: Asset attempted to compress while creating page response & not during asset request
Following are the configurations in my production.rb file: # Disable live compilation of assets(Don''t fallback to assets pipeline if a precompiled asset is missed) config.assets.compile = false # Assets pre-compilation task(rake assets:precompile) configurations config.assets.css_compressor = :yui config.assets.js_compressor = :yui config.assets.compress = true Let me know, if these configs are specified correctly. On Friday, 12 July 2013 10:52:24 UTC+5:30, farukhdm wrote:> > Thanks for the update. > > jquery.bxslider.min.js in my case is not part of application.js > > I have added jquery.bxslider.min.js to pre-compile path also, so that it > can be loaded independently. > Its available in public/assets folder too. > > You said "I''m not surprised it is re-compiling the source code at > runtime."..I totally agree. > However that should happen when browser request that very particular > asset, not while creating page response that has > > <script src="jquery.bxslider.min.js"></script> > > in the markup. > > Am I going astray here in making you understand the issue. > Let me know. > > > On Thursday, 11 July 2013 21:58:03 UTC+5:30, mike wrote: >> >> >> >> On Thursday, July 11, 2013 7:24:34 AM UTC-4, farukhdm wrote: >>> >>> Hi, >>> >>> I am stuck in a weird situation where in my production environment, an >>> asset is being attempted to compress while rendering a view. >>> I''ve all my assets put into public/assets folder via rake >>> "assets:precompile" >>> >>> production.rb has following configurations: >>> -------------------------------------------------------------- >>> # Disable live compilation of assets(Don''t fallback to assets pipeline >>> if a precompiled asset is missed) >>> config.assets.compile = false >>> >>> # Assets pre-compilation task(rake assets:precompile) configurations >>> config.assets.css_compressor = :yui >>> config.assets.js_compressor = :yui >>> config.assets.compress = true >>> >>> >>> When I request for some page let say http://www.example.com/home, >>> while generating the page response, Rails is trying to compress an asset >>> named >>> "jquery.bxslider.min" >>> >>> I''ve following code that is creating error. >>> >>> <%= content_for :js_include do %> >>> <%= javascript_include_tag ''jquery.bxslider.min'' %> >>> <% end %> >>> >>> Error in log: >>> ============>>> ActionView::Template::Error (undefined method `exitstatus'' for nil:NilClass >>> (in /example/lib/assets/javascripts/jquery.bxslider.min.js)): >>> 57: <%= content_for :js_include do %> >>> 58: <%= javascript_include_tag ''jquery.bxslider.min'' %> >>> 59: <% end %> >>> >>> >>> The error is however for missing java(as I''m using YUI for compression, which depends on java) >>> >>> I don''t want any live compression & compilation, as assets are already available in public/assets folder >>> >>> >>> I am surprised, why Rails is trying to compress asset while rendering an action. >>> >>> >>> Please advise. >>> >>> >>> Regards >>> >>> Farukh D M >>> >> >> I''m not surprised it is re-compiling the source code at runtime. You >> have to be careful with javascript_include_tag when you are using the asset >> pipeline. When you precompile your assets, everything is put into one js >> file with a long, cryptic name that looks something like the following in >> html: >> >> <script >> src="/assets/application-931a21730f0f60d50be598cdd891dccf.js"></script> >> >> When you then insert a javascript tag, it''s going to look like the >> following in your html: >> >> <script src="jquery.bxslider.min.js"></script> >> >> The browser is going to attempt to load both files. It doesn''t detect >> that the contents of jquery.bxslider.min.js are actually already in the >> first file. Because this file is located in the /app/assets/js directory, >> it''s going to be processed by rails through the asset compiler when the >> browser requests the file. >> >> You shouldn''t reference a javascript file in a script tag if you''ve >> already included it in the asset pipeline unless you truly intend to load >> it twice. >> >> If you have javascript you want to load independent of the asset pipeline >> and you don''t want it processed through the asset compiler, you should >> reference it in a javascript_include_tag as you have done above, but you >> should locate the file in the public/js directory. >> >> >> >> >> >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/aca73f18-c80c-44c3-837a-0da5870688b3%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
mike
2013-Jul-12 19:45 UTC
Re: Asset Pipeline: Asset attempted to compress while creating page response & not during asset request
On Friday, July 12, 2013 2:07:55 AM UTC-4, farukhdm wrote:> > Following are the configurations in my production.rb file: > > # Disable live compilation of assets(Don''t fallback to assets pipeline > if a precompiled asset is missed) > config.assets.compile = false > > # Assets pre-compilation task(rake assets:precompile) configurations > config.assets.css_compressor = :yui > config.assets.js_compressor = :yui > config.assets.compress = true > > Let me know, if these configs are specified correctly. > > On Friday, 12 July 2013 10:52:24 UTC+5:30, farukhdm wrote: >> >> Thanks for the update. >> >> jquery.bxslider.min.js in my case is not part of application.js >> >> I have added jquery.bxslider.min.js to pre-compile path also, so that it >> can be loaded independently. >> Its available in public/assets folder too. >> >> You said "I''m not surprised it is re-compiling the source code at >> runtime."..I totally agree. >> However that should happen when browser request that very particular >> asset, not while creating page response that has >> >> <script src="jquery.bxslider.min.js"></script> >> >> in the markup. >> >> Am I going astray here in making you understand the issue. >> Let me know. >> >> >> On Thursday, 11 July 2013 21:58:03 UTC+5:30, mike wrote: >>> >>> >>> >>> On Thursday, July 11, 2013 7:24:34 AM UTC-4, farukhdm wrote: >>>> >>>> Hi, >>>> >>>> I am stuck in a weird situation where in my production environment, an >>>> asset is being attempted to compress while rendering a view. >>>> I''ve all my assets put into public/assets folder via rake >>>> "assets:precompile" >>>> >>>> production.rb has following configurations: >>>> -------------------------------------------------------------- >>>> # Disable live compilation of assets(Don''t fallback to assets pipeline >>>> if a precompiled asset is missed) >>>> config.assets.compile = false >>>> >>>> # Assets pre-compilation task(rake assets:precompile) configurations >>>> config.assets.css_compressor = :yui >>>> config.assets.js_compressor = :yui >>>> config.assets.compress = true >>>> >>>> >>>> When I request for some page let say http://www.example.com/home, >>>> while generating the page response, Rails is trying to compress an asset >>>> named >>>> "jquery.bxslider.min" >>>> >>>> I''ve following code that is creating error. >>>> >>>> <%= content_for :js_include do %> >>>> <%= javascript_include_tag ''jquery.bxslider.min'' %> >>>> <% end %> >>>> >>>> Error in log: >>>> ============>>>> ActionView::Template::Error (undefined method `exitstatus'' for nil:NilClass >>>> (in /example/lib/assets/javascripts/jquery.bxslider.min.js)): >>>> 57: <%= content_for :js_include do %> >>>> 58: <%= javascript_include_tag ''jquery.bxslider.min'' %> >>>> 59: <% end %> >>>> >>>> >>>> The error is however for missing java(as I''m using YUI for compression, which depends on java) >>>> >>>> I don''t want any live compression & compilation, as assets are already available in public/assets folder >>>> >>>> >>>> I am surprised, why Rails is trying to compress asset while rendering an action. >>>> >>>> >>>> Please advise. >>>> >>>> >>>> Regards >>>> >>>> Farukh D M >>>> >>> >>> I''m not surprised it is re-compiling the source code at runtime. You >>> have to be careful with javascript_include_tag when you are using the asset >>> pipeline. When you precompile your assets, everything is put into one js >>> file with a long, cryptic name that looks something like the following in >>> html: >>> >>> <script >>> src="/assets/application-931a21730f0f60d50be598cdd891dccf.js"></script> >>> >>> When you then insert a javascript tag, it''s going to look like the >>> following in your html: >>> >>> <script src="jquery.bxslider.min.js"></script> >>> >>> The browser is going to attempt to load both files. It doesn''t detect >>> that the contents of jquery.bxslider.min.js are actually already in the >>> first file. Because this file is located in the /app/assets/js directory, >>> it''s going to be processed by rails through the asset compiler when the >>> browser requests the file. >>> >>> You shouldn''t reference a javascript file in a script tag if you''ve >>> already included it in the asset pipeline unless you truly intend to load >>> it twice. >>> >>> If you have javascript you want to load independent of the asset >>> pipeline and you don''t want it processed through the asset compiler, you >>> should reference it in a javascript_include_tag as you have done above, but >>> you should locate the file in the public/js directory. >>> >>> >>> >>> >>> >>You''re right, I didn''t fully understand the issue. The settings in your production.rb are typical production settings. However, in this case, the first setting, config.assets.compile = false has implications. When this is set to false, the system assumes all assets have been pre-compiled. When you pre-compile, a manifest is generated that maps the "normal" file names to the cryptic filename it''s now compressed into. When html code is generated from a view, it references the manifest, and substitutes the cryptic filename. This is the point where I''m unsure of what happens. In your case, there''s a file referenced in the assets directory that isn''t in the manifest and isn''t pre-compiled. I''m not sure what the system does because when this flag is set to false, it doesn''t even load the pipeline gems so it doesn''t have access to the compiler. I''m guessing it throws an error, but that''s a guess, which would be the error you encountered. I''d have to test this but my guess is that you either need to pre-compile the asset, or locate it in the public directory (only) and write the tag to access the file in the public directory. I''m not sure this is correct, but hopefully it will point you in the right direction. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1b9f25e0-7381-4d41-8353-e0ccb3eb37d1%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
farukhdm
2013-Jul-15 04:32 UTC
Re: Asset Pipeline: Asset attempted to compress while creating page response & not during asset request
Hey, Thanks for enlightenment :) I shall perform some ups and downs. Will let you know, if I get any new insight On Saturday, 13 July 2013 01:15:01 UTC+5:30, mike wrote:> > > > On Friday, July 12, 2013 2:07:55 AM UTC-4, farukhdm wrote: >> >> Following are the configurations in my production.rb file: >> >> # Disable live compilation of assets(Don''t fallback to assets pipeline >> if a precompiled asset is missed) >> config.assets.compile = false >> >> # Assets pre-compilation task(rake assets:precompile) configurations >> config.assets.css_compressor = :yui >> config.assets.js_compressor = :yui >> config.assets.compress = true >> >> Let me know, if these configs are specified correctly. >> >> On Friday, 12 July 2013 10:52:24 UTC+5:30, farukhdm wrote: >>> >>> Thanks for the update. >>> >>> jquery.bxslider.min.js in my case is not part of application.js >>> >>> I have added jquery.bxslider.min.js to pre-compile path also, so that it >>> can be loaded independently. >>> Its available in public/assets folder too. >>> >>> You said "I''m not surprised it is re-compiling the source code at >>> runtime."..I totally agree. >>> However that should happen when browser request that very particular >>> asset, not while creating page response that has >>> >>> <script src="jquery.bxslider.min.js"></script> >>> >>> in the markup. >>> >>> Am I going astray here in making you understand the issue. >>> Let me know. >>> >>> >>> On Thursday, 11 July 2013 21:58:03 UTC+5:30, mike wrote: >>>> >>>> >>>> >>>> On Thursday, July 11, 2013 7:24:34 AM UTC-4, farukhdm wrote: >>>>> >>>>> Hi, >>>>> >>>>> I am stuck in a weird situation where in my production environment, an >>>>> asset is being attempted to compress while rendering a view. >>>>> I''ve all my assets put into public/assets folder via rake >>>>> "assets:precompile" >>>>> >>>>> production.rb has following configurations: >>>>> -------------------------------------------------------------- >>>>> # Disable live compilation of assets(Don''t fallback to assets >>>>> pipeline if a precompiled asset is missed) >>>>> config.assets.compile = false >>>>> >>>>> # Assets pre-compilation task(rake assets:precompile) configurations >>>>> config.assets.css_compressor = :yui >>>>> config.assets.js_compressor = :yui >>>>> config.assets.compress = true >>>>> >>>>> >>>>> When I request for some page let say http://www.example.com/home, >>>>> while generating the page response, Rails is trying to compress an asset >>>>> named >>>>> "jquery.bxslider.min" >>>>> >>>>> I''ve following code that is creating error. >>>>> >>>>> <%= content_for :js_include do %> >>>>> <%= javascript_include_tag ''jquery.bxslider.min'' %> >>>>> <% end %> >>>>> >>>>> Error in log: >>>>> ============>>>>> ActionView::Template::Error (undefined method `exitstatus'' for nil:NilClass >>>>> (in /example/lib/assets/javascripts/jquery.bxslider.min.js)): >>>>> 57: <%= content_for :js_include do %> >>>>> 58: <%= javascript_include_tag ''jquery.bxslider.min'' %> >>>>> 59: <% end %> >>>>> >>>>> >>>>> The error is however for missing java(as I''m using YUI for compression, which depends on java) >>>>> >>>>> I don''t want any live compression & compilation, as assets are already available in public/assets folder >>>>> >>>>> >>>>> I am surprised, why Rails is trying to compress asset while rendering an action. >>>>> >>>>> >>>>> Please advise. >>>>> >>>>> >>>>> Regards >>>>> >>>>> Farukh D M >>>>> >>>> >>>> I''m not surprised it is re-compiling the source code at runtime. You >>>> have to be careful with javascript_include_tag when you are using the asset >>>> pipeline. When you precompile your assets, everything is put into one js >>>> file with a long, cryptic name that looks something like the following in >>>> html: >>>> >>>> <script >>>> src="/assets/application-931a21730f0f60d50be598cdd891dccf.js"></script> >>>> >>>> When you then insert a javascript tag, it''s going to look like the >>>> following in your html: >>>> >>>> <script src="jquery.bxslider.min.js"></script> >>>> >>>> The browser is going to attempt to load both files. It doesn''t detect >>>> that the contents of jquery.bxslider.min.js are actually already in the >>>> first file. Because this file is located in the /app/assets/js directory, >>>> it''s going to be processed by rails through the asset compiler when the >>>> browser requests the file. >>>> >>>> You shouldn''t reference a javascript file in a script tag if you''ve >>>> already included it in the asset pipeline unless you truly intend to load >>>> it twice. >>>> >>>> If you have javascript you want to load independent of the asset >>>> pipeline and you don''t want it processed through the asset compiler, you >>>> should reference it in a javascript_include_tag as you have done above, but >>>> you should locate the file in the public/js directory. >>>> >>>> >>>> >>>> >>>> >>> > You''re right, I didn''t fully understand the issue. The settings in your > production.rb are typical production settings. However, in this case, the > first setting, config.assets.compile = false has implications. > > When this is set to false, the system assumes all assets have been > pre-compiled. When you pre-compile, a manifest is generated that maps the > "normal" file names to the cryptic filename it''s now compressed into. When > html code is generated from a view, it references the manifest, and > substitutes the cryptic filename. > > This is the point where I''m unsure of what happens. In your case, there''s > a file referenced in the assets directory that isn''t in the manifest and > isn''t pre-compiled. I''m not sure what the system does because when this > flag is set to false, it doesn''t even load the pipeline gems so it doesn''t > have access to the compiler. I''m guessing it throws an error, but that''s a > guess, which would be the error you encountered. > > I''d have to test this but my guess is that you either need to pre-compile > the asset, or locate it in the public directory (only) and write the tag to > access the file in the public directory. > > I''m not sure this is correct, but hopefully it will point you in the right > direction. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/dc09debc-5b9e-4e8f-8768-1732b32a390e%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
farukhdm
2013-Jul-15 10:49 UTC
Re: Asset Pipeline: Asset attempted to compress while creating page response & not during asset request
Hi, FYI... With config.assets.compile = false(live compilation disabled) I removed entry from manifest.yml file and I got: ActionView::Template::Error (jquery.bxslider.min.js isn''t precompiled) which I guess it valid error message. Had there been, config.assets.compile = true + missing mappin in manifest and no java to support YUI gem to compress. Not sure what would happen. On Thursday, 11 July 2013 16:54:34 UTC+5:30, farukhdm wrote:> > Hi, > > I am stuck in a weird situation where in my production environment, an > asset is being attempted to compress while rendering a view. > I''ve all my assets put into public/assets folder via rake > "assets:precompile" > > production.rb has following configurations: > -------------------------------------------------------------- > # Disable live compilation of assets(Don''t fallback to assets pipeline if > a precompiled asset is missed) > config.assets.compile = false > > # Assets pre-compilation task(rake assets:precompile) configurations > config.assets.css_compressor = :yui > config.assets.js_compressor = :yui > config.assets.compress = true > > > When I request for some page let say http://www.example.com/home, while > generating the page response, Rails is trying to compress an asset named > "jquery.bxslider.min" > > I''ve following code that is creating error. > > <%= content_for :js_include do %> > <%= javascript_include_tag ''jquery.bxslider.min'' %> > <% end %> > > Error in log: > ============> ActionView::Template::Error (undefined method `exitstatus'' for nil:NilClass > (in /example/lib/assets/javascripts/jquery.bxslider.min.js)): > 57: <%= content_for :js_include do %> > 58: <%= javascript_include_tag ''jquery.bxslider.min'' %> > 59: <% end %> > > > The error is however for missing java(as I''m using YUI for compression, which depends on java) > > I don''t want any live compression & compilation, as assets are already available in public/assets folder > > > I am surprised, why Rails is trying to compress asset while rendering an action. > > > Please advise. > > > Regards > > Farukh D M >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/63a18d84-811f-402f-ace7-e23eb401e6ce%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.