
register_minifier ' text/css ', Condenser :: SassMinifier environment. If you're not using Rails, configure this directly on the "environment". In Rails you will specify them with: config. Several JavaScript and CSS minifiers are available through shorthand. If the ejs gem is available to your application, you can use EJS That will cause a recompile if the value changes.įor example if you have this in your. If you're using Rails, there are helpers you can use such as asset_url Must manually invalidate the cache to see the change. If you are pulling a value from somewhere else, such as a database, This behavior is only true for environment variables, When you change then ENV var the asset will be forced to You could have this in the template var app_name = "" erb to a CSS or JavaScript asset's filename to enable the ERB engine.įor example if you have an app/application/javascripts/app_name.js.erb Invoking Ruby with ERBĬondenser provides an ERB engine for preprocessing assets using embedded RubyĬode.
#CSS CONDENSER INSTALL#
In Rails you can force a "clean" install by clearing the public/assets and "fresh" based on their inode number, mtime, size and a combination of cache keys. What assets need to be re-compiled when a file changes. If theseįiles were expensive to generate, then this "partial" asset cache strategy canĭirectives such as import in Javascript and in SCSS tell Condenser We can use the prior intermediary files stored in the cached values.

Recompile the other files from a.js to z.js since they did not change, So, if b.js changes it will get recompiled. The cache directory (usually tmp/cache/assets). To disk, but also intermediary compiled files for a.js etc. The first time this file is compiled the application.js output will be written Public/assets, what might not be as intuitive is that Condenser needs to cacheįor example if you have an application.js and it is made up of a.js, b.js, It makes sense thatĬondenser does not want to generate assets that already exist on disk in Has a cache and if you've found a bug it's likely going to involve the cache.īy default Condenser uses the file system to cache assets. Because of this Condenser has a cache to speed upĪsset compilation times. Hard drives, a lot of RAM to manipulate those files in memory, and a lot of CPUįor compilation operations. It requires a lot of disk use to pull assets off of The directives must be the first portion of the file. To tell Condenser that this file depends on models/* simply add the depends_on
#CSS CONDENSER UPDATE#
ForĮxample a js.erb file maybe dynamically update depending on the contents of a Sometimes you need to tell Condenser that a file depends on other files. Import gamma from 'config/initializers/gamma' Import beta from 'config/initializers/beta' Manually: import alpha from 'config/initializers/alpha' Order dependent you can either rename the files or require individual files Problem if gamma.js needs to be called before alpha.js. Then alpha.js will be loaded before either of the other two. Looks like this: $ ls -1 config/initializers/ The files in that directory will be loaded in alphabetical order. Your asset compilation when one asset needs to be loaded before another.įor example if you have an application.js and it loads another directory import initializers from 'config/initializers/*' File Order Processingīy default files are processed in alphabetical order. Hello.js even if the file on disk is a coffeescript file, since the asset Note: For assets that are compiled or transpiled, you may want to specify theĮxtension that you want, not the extension on disk. For example, if your load pathĬontains the directory app/assets/javascripts: Logical path The logical path is the path of the asset source file relative to itsĬontaining directory in the load path. Accessing AssetsĪssets in Condenser are always referenced by their logical path. For that documentation you should see yourįramework's documentation.

Since you are likely using Condenser through another framework, there will beĬonfiguration options you can toggle that will change behavior such as whatĭirectories or files get compiled. If you want to work on Condenser or better understand how it works read How Condenser Works. If you are a library developer who is extending Condenser, see Extending Condenser. If you are a framework developer see Building an Asset Processing Framework. If you are using Condenser with Rails, instead of the condenser gem use theįor most people interested in Condenser, you will want to see the README below. In your project's Gemfile with Bundler: gem ' condenser ' Condenser is a Ruby library for compiling and serving static web assetsĪ powerful pipeline that allows you to write assets in languages like Sass
