How premailer-rails inlines CSS
mainThe gem works by registering a delivery hook with actionmailer. When an email is delivered, premailer-rails collects URLs from <link rel="stylesheet" href="..."> tags and attempts to retrieve their content using the following strategies in order:
:filesystem: Looks for a file in thepublic/directory matching the URL path.:asset_pipeline: If Rails is available and the asset pipeline is enabled, it strips the fingerprint and prefix from the URL to request the asset via the pipeline.:network: Performs a standard HTTP request to the URL (useful for assets hosted on a CDN).
In Rails production environments, retrieved CSS is cached. To prevent specific tags (like Google Fonts) from being inlined, add the data-premailer="ignore" attribute to the tag.