Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This may not <em>entirely</em> answer your question, but I believe it is a decent enough start. As you'll see, the precise answer will depend on the individual application, gem versions and so on.</p> <p>So. For asset-related work, as you know, Rails uses a library called Sprockets, which in newer versions of Rails is, I believe, hooked into Rails as a Railtie. It initializes a Sprockets "environment" that can do things like look at your asset manifest, load those files, compress them, give the compiled assets sensible names, etc.</p> <p>By default, that <code>Sprockets::Environment</code> logs its activity to <code>STDERR</code> with a log level of <code>FATAL</code>, which isn't very useful in these situations. Fortunately, the <code>Sprockets::Environment</code> (as of <code>2.2.2</code>) has a writeable logger attribute that you can patch in via Rails, using an initializer.</p> <hr> <p><strong>So, here's what I suggest, to start:</strong></p> <p>In <code>config/initializers</code>, create a file, something like <code>asset_logging.rb</code>. In it, put:</p> <pre><code>Rails.application.assets.logger = Logger.new($stdout) </code></pre> <p>This overwrites the default logger with one that will spit more information out to <code>STDOUT</code>. Once you've got this set up, then run your asset pre-compilation task:</p> <pre><code>rake RAILS_ENV=production assets:precompile </code></pre> <p>And you should see <em>slightly</em> more interesting output, such as:</p> <pre><code>... Compiled jquery.ui.core.js (0ms) (pid 66524) Compiled jquery.ui.widget.js (0ms) (pid 66524) Compiled jquery.ui.accordion.js (10ms) (pid 66524) ... </code></pre> <hr> <p>But, in the end, the final answer will depend on:</p> <ul> <li>how "deep" you want to go with logging this asset stuff</li> <li>what specific version of Rails, Sprockets, etc. you're using</li> <li>and what you find along the way</li> </ul> <p>As you've already learned, log spelunking at the Rake task level, or even at the Rails level, doesn't give much information. And even making Sprockets itself verbose (see above) doesn't tell you too terribly much.</p> <p>If you wanted to go deeper than Sprockets, you can probably monkey patch the various engines and processors that Sprockets dutifully chains together to make the asset pipeline work. For example, you could look into the logging capabilities of these components:</p> <ul> <li><code>Sass::Engine</code> (converts SASS to CSS)</li> <li><code>Uglifier</code> (JavaScript compressor wrapper)</li> <li><code>ExecJS</code> (runs JavaScript in Ruby; a dependency of both Sprockets and Uglifier)</li> <li><code>therubyracer</code> (V8 embedded in Ruby; used by <code>ExecJS</code>)</li> <li>etc.</li> </ul> <p>But I will leave all that as "an exercise for the reader." If there's a silver bullet, I'd certainly like to know about it!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload