From 54103c5c692f88b2baa4a4afe4d15fc6502014e4 Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Fri, 19 Jul 2024 10:39:23 +0530 Subject: [PATCH] document how to chain ERB for custom processors This section was introduced in 4b757b0201 but never completed. --- guides/extending_sprockets.md | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/guides/extending_sprockets.md b/guides/extending_sprockets.md index 8663e27e1..f4c402067 100644 --- a/guides/extending_sprockets.md +++ b/guides/extending_sprockets.md @@ -292,21 +292,13 @@ Sprockets.register_preprocessor 'text/coffeescript', DirectiveProcessor.new(comm In Sprockets 4 file types are no longer "chainable" this means that if you wanted to use a `.coffee.erb` that it must be registered to sprockets explicitly. This is different from previous versions of sprockets where you would have to register only a `.erb` processor and then a `.coffee` processor and sprockets would chain them (first running erb then coffee). -The reason for the change is to have more explicit behavior. It helps sprockets know to do the right thing, decreases magic, and increases speed. It also means that as a library maintainer you must tell sprockets all the extensions you want your project to work with. Going with the coffee script example. You would need to register a mime type +The reason for the change is to have more explicit behavior. It helps sprockets know to do the right thing, decreases magic, and increases speed. It also means that as a library maintainer you must tell sprockets all the extensions you want your project to work with. Going with the coffee script example: - - ## Supporting All Versions of Sprockets in Processors If you are extending sprockets you may want to support all current major versions of sprockets (2, 3, and 4). The processor interface was deprecated from Sprockets 2 and a legacy shim was put into Sprockets 3. Now that Sprockets 4 is out that shim no longer is active, so you'll need to update your gem to either only use the new interface or use both interfaces. For example: