Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asset_pack_path + HMR #1171

Closed
timonbandit opened this issue Jan 12, 2018 · 4 comments
Closed

asset_pack_path + HMR #1171

timonbandit opened this issue Jan 12, 2018 · 4 comments

Comments

@timonbandit
Copy link
Contributor

Hi!
i can't use asset_pack_path with HMR on my dev machine due of

Webpacker can't find theme1.css in /var/www/app/public/packs/manifest.json.

it's works for js, but not for css, which i'm using for this:

<script>
  loadCSS("<%= asset_pack_path('theme1.css') %>");
</script>

i think problem is in helper.rb

  def asset_pack_path(name, **options)
    asset_path(Webpacker.manifest.lookup!(name), **options)
  end

stylesheet_pack_tag helper is checking if it on dev server or HMR:

def stylesheet_pack_tag(*names, **options)
    unless Webpacker.dev_server.running? && Webpacker.dev_server.hot_module_replacing?
      stylesheet_link_tag(*sources_from_pack_manifest(names, type: :stylesheet), **options)
    end
  end

Is it ok to send a PR?

@gauravtiwari
Copy link
Member

Please do 👍

@timonbandit
Copy link
Contributor Author

@gauravtiwari done 👍

@sudomf
Copy link

sudomf commented Jan 26, 2018

Hey guys, I know that it's merged, but, how I'll use asset_pack_path for images in development environment? After upgrading to the version 3.2.1, I can't see my images in development env with dev server and hmr enabled.

@gauravtiwari
Copy link
Member

Yeah this introduced a bug for other asset types. Will fix during the weekend.

kawikadkekahuna added a commit to wealthfit/webpacker that referenced this issue Jan 29, 2018
* 'master' of https://github.com/rails/webpacker: (21 commits)
  Update Ruby versions on Travis CI (rails#1230)
  Make rubocop happy
  Fix asset helper for non-css assets in hmr mode
  CSP warning for Rails 5.2
  use 2 spaces for indentation in template injection
  Update README.md (rails#1198)
  Remove duplicate yarn-error.log (rails#1197)
  3.2.1
  Revert file loader (rails#1196)
  Update default extensions and move to installer (rails#1181)
  Gitignore (rails#1195)
  Update uglify plugin (rails#1194)
  Fixes Vue root instance initialization (rails#1187)
  Return false in production environments (rails#1179)
  Fix url loader doc[ci skip] (rails#1183)
  Use inject_into_file to support rails 4.2
  Update gems and npm deps (rails#1180)
  asset_pack_path + HMR fix; Closes rails#1171 (rails#1172)
  enhance CHANGELOG.md (rails#1170)
  CI against Ruby 2.5.0
  ...
KingTiger001 added a commit to KingTiger001/Rails-web-pack-project that referenced this issue Jan 15, 2023
smartech7 pushed a commit to smartech7/ruby-webpacker that referenced this issue Aug 4, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants