README.md in shakapacker-6.5.5 vs README.md in shakapacker-6.5.6

- old
+ new

@@ -19,17 +19,26 @@ Check out 6.1.1+ for [SWC](https://swc.rs/) and [esbuild-loader](https://github.com/privatenumber/esbuild-loader) support! They are faster than Babel! See a comparison of [Shakapacker with jsbundling-rails](https://github.com/rails/jsbundling-rails/blob/main/docs/comparison_with_webpacker.md). -Discussion forum and Slack to discuss debugging and troubleshooting tips. Please open issues for bugs and feature requests: -1. [Discussions tab](https://github.com/shakacode/shakapacker/discussions) -2. [Slack discussion channel](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE) -3. [Tweets with tag `#shakapacker`](https://twitter.com/hashtag/shakapacker?src=hashtag_click) +For discussions, see our [Slack Channel](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE). -[ShakaCode](https://www.shakacode.com) offers support for upgrading from webpacker and using Shakapacker. If interested, contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com). ShakaCode is [hiring passionate engineers](https://jobs.lever.co/shakacode/3bdbfdb3-4495-4611-a279-01dddb351abe) that love open source. +--- +### ShakaCode Support +[ShakaCode](https://www.shakacode.com) offers support for upgrading from webpacker and using Shakapacker. If interested, contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com). We're also [hiring](https://jobs.lever.co/shakacode/3bdbfdb3-4495-4611-a279-01dddb351abe)! + +Here's a testimonial of how ShakaCode can help, from [Florian Gâßler](https://github.com/FGoessler) of [Blinkist](https://www.blinkist.com/), January 2, 2023: +> Hey Justin πŸ‘‹ +> +> I just wanted to let you know that we today shipped the webpacker to shakapacker upgrades and it all seems to be running smoothly! Thanks again for all your support and your teams work! 😍 +> +> On top of your work, it was now also very easy for me to upgrade Tailwind and include our external node_module based web component library which we were using for our other (more modern) apps already. That work is going to be shipped later this week though as we are polishing the last bits of it. πŸ˜‰ +> +> Have a great 2023 and maybe we get to work together again later in the year! πŸ™Œ + --- <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> @@ -42,11 +51,11 @@ - [Concepts](#concepts) - [Usage](#usage) - [Configuration and Code](#configuration-and-code) - [View Helpers](#view-helpers) - [View Helpers `javascript_pack_tag` and `stylesheet_pack_tag`](#view-helpers-javascript_pack_tag-and-stylesheet_pack_tag) - - [View Helper `append_javascript_pack_tag` and `append_stylesheet_pack_tag`](#view-helper-append_javascript_pack_tag-and-append_stylesheet_pack_tag) + - [View Helpers `append_javascript_pack_tag`, `prepend_javascript_pack_tag` and `append_stylesheet_pack_tag`](#view-helper-append_javascript_pack_tag-prepend_javascript_pack_tag-and-append_stylesheet_pack_tag) - [View Helper: `asset_pack_path`](#view-helper-asset_pack_path) - [View Helper: `image_pack_tag`](#view-helper-image_pack_tag) - [View Helper: `favicon_pack_tag`](#view-helper-favicon_pack_tag) - [View Helper: `preload_pack_asset`](#view-helper-preload_pack_asset) - [Images in Stylesheets](#images-in-stylesheets) @@ -256,11 +265,11 @@ ``` erb <%= stylesheet_pack_tag 'application', media: 'screen' %> <%= stylesheet_pack_tag 'print', media: 'print' %> ``` -#### View Helper `append_javascript_pack_tag` and `append_stylesheet_pack_tag` +#### View Helper `append_javascript_pack_tag`, `prepend_javascript_pack_tag` and `append_stylesheet_pack_tag` If you need configure your script pack names or stylesheet pack names from the view for a route or partials, then you will need some logic to ensure you call the helpers only once with multiple arguments. The new view helpers, `append_javascript_pack_tag` and `append_stylesheet_pack_tag` can solve this problem. The helper `append_javascript_pack_tag` will queue up script packs when the `javascript_pack_tag` is finally used. Similarly,`append_stylesheet_pack_tag` will queue up style packs when the `stylesheet_pack_tag` is finally used. Main view: ```erb @@ -289,20 +298,44 @@ However, you typically can't do that in the main layout, as the view and partial codes will depend on the route. Thus, you can distribute the logic of what packs are needed for any route. All the magic of splitting up the code and CSS was automatic! -**Important:** Both `append_(javascript/stylesheet)_pack_tag` helpers can be used anywhere in your application as long as they are executed BEFORE `(javascript/stylesheet)_pack_tag` respectively. If you attempt to call one of the `append_(javascript/stylesheet)_pack_tag` helpers after the respective `(javascript/stylesheet)_pack_tag`, an error will be raised. +**Important:** These helpers can be used anywhere in your application as long as they are executed BEFORE `(javascript/stylesheet)_pack_tag` respectively. If you attempt to call one of these helpers after the respective `(javascript/stylesheet)_pack_tag`, an error will be raised. The typical issue is that your layout might reference some partials that need to configure packs. A good way to solve this problem is to use `content_for` to ensure that the code to render your partial comes before the call to `javascript_pack_tag`. ```erb <% content_for :footer do render 'shared/footer' %> <%= javascript_pack_tag %> <%= content_for :footer %> +``` + +There is also `prepend_javascript_pack_tag` that will put the entry at the front of the queue. This is handy when you want an entry in the main layout to go before the partial and main layout `append_javascript_pack_tag` entries. + +Main view: +```erb +<% append_javascript_pack_tag 'map' %> +``` + +Some partial: +```erb +<% append_javascript_pack_tag 'map' %> +``` + +And the main layout has: +```erb +<% prepend_javascript_pack_tag 'main' %> +<%= javascript_pack_tag 'application' %> +``` + +is the same as using this in the main layout: + +```erb +<%= javascript_pack_tag 'main', 'calendar', 'map', application' %> ``` For alternative options of setting the additional packs, [see this discussion](https://github.com/shakacode/shakapacker/issues/39). #### View Helper: `asset_pack_path`