Module: Thredded::WebpackAssets
- Defined in:
- lib/thredded/webpack_assets.rb
Overview
Lets you include Thredded JavaScripts into your Webpack “pack”.
To use this, first run ‘bundle exec rails webpacker:install:erb`. Then, rename `app/javascript/packs/application.js` to `app/javascript/packs/application.js.erb` Finally, add this line to `app/javascript/packs/application.js.erb`:
<%= Thredded::WebpackAssets.javascripts %>
To include additional timeago locales, add this before ‘Thredded::WebpackAssets.javascripts`:
<% timeago_root = File.join(Gem.loaded_specs.full_gem_path, ‘assets’, ‘javascripts’) %>
import "<%= File.join(timeago_root, 'timeago.js') %>";
<%= %w[de pt_BR].map { |locale| %(import “#”timeago/locales/#{locale.js“)}”;) } * “n” %>
Defined Under Namespace
Classes: JavaScriptsResolver
Constant Summary collapse
- JAVASCRIPT_EXTS =
%w[.es6 .js].freeze
Class Method Summary collapse
Class Method Details
.javascripts ⇒ Object
23 24 25 |
# File 'lib/thredded/webpack_assets.rb', line 23 def self.javascripts @javascripts ||= JavaScriptsResolver.new.resolve('thredded.es6') end |