Skip to content

Commit

Permalink
Update Changelog, Docs and Error Message
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkitkkr committed Jun 30, 2022
1 parent 184ab84 commit 1073953
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
## [Unreleased]
Changes since last non-beta release.

- Added `append_stylesheet_pack_tag` helper, which is required for filesystem-based automated Component Registry API on React-on-Rails.
### Added
- `append_stylesheet_pack_tag` helper. It helps in configuring stylesheet pack names from the view for a route or partials. It is also required for filesystem-based automated Component Registry API on React on Rails gem. [PR 144](https://github.com/shakacode/shakapacker/pull/144) by [pulkitkkr](https://github.com/pulkitkkr).

_Please add entries here for your pull requests that are not yet released._

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ Thus, you can distribute the logic of what packs are needed for any route. All t

**Important:** `append_javascript_pack_tag` can be used anywhere in your application as long as it is executed BEFORE the `javascript_pack_tag`. If you attempt to call `append_javascript_pack_tag` helper after `javascript_pack_tag`, an error will be raised. You should have only a single `javascript_pack_tag` invocation in your page load.

**Important** Similar to `append_javascript_pack_tag`, the `append_stylesheet_pack_tag` should be used anywhere in your application as long as it is executed BEFORE the `stylesheet_pack_tag`. However, if you attempt to call `append_stylesheet_pack_tag` helper after `stylesheet_pack_tag`, an error will be **NOT** be raised.

**Important** Similar to `append_javascript_pack_tag`, the `append_stylesheet_pack_tag` should be used anywhere in your application as long as it is executed BEFORE the `stylesheet_pack_tag`. If you attempt to call `append_stylesheet_pack_tag` helper after `stylesheet_pack_tag`, an error will be raised. However, you may have multiple invocation of `stylesheet_pack_tag`
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
Expand Down
4 changes: 2 additions & 2 deletions lib/webpacker/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def stylesheet_pack_tag(*names, **options)
def append_stylesheet_pack_tag(*names)
if @stylesheet_pack_tag_loaded
raise "You can only call append_stylesheet_pack_tag before stylesheet_pack_tag helper. " \
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#usage for the usage guide"
"Please refer to the documentation for stylesheet_pack_tag for more information."
end

@stylesheet_pack_tag_queue ||= []
Expand All @@ -179,7 +179,7 @@ def append_stylesheet_pack_tag(*names)
def append_javascript_pack_tag(*names, defer: true)
if @javascript_pack_tag_loaded
raise "You can only call append_javascript_pack_tag before javascript_pack_tag helper. " \
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#usage for the usage guide"
"PPlease refer to the documentation for javascript_pack_tag for more information."
end

hash_key = defer ? :deferred : :non_deferred
Expand Down

0 comments on commit 1073953

Please sign in to comment.