Skip to content

Commit

Permalink
Update README.md and rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Jul 29, 2017
1 parent fe78242 commit cf64c24
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ group :test do
gem "minitest", "~> 5.0"
end


if ENV["USE_PRY"]
gem "awesome_print"
gem "pry"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,14 @@ development:
host: 0.0.0.0
port: 8080
https: false
hot: false
```

If you have hot turned to `true`, then the `stylesheet_pack_tag` generates no output, as you will want
to configure your styles to be inlined in your JavaScript for hot reloading. During production and testing, the
`stylesheet_pack_tag` will create the appropriate HTML tags.


#### Resolved Paths

If you are adding webpacker to an existing app that has most of the assets inside
Expand Down
5 changes: 2 additions & 3 deletions lib/webpacker/dev_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

require "webpacker/configuration"


class Webpacker::DevServer < Webpacker::FileLoader
class << self
def dev_server?
Expand All @@ -14,8 +13,8 @@ def dev_server?
# read settings for dev_server
def hot?
return false unless dev_server?
if ENV['WEBPACKER_HMR'].present?
val = ENV['WEBPACKER_HMR'].downcase
if ENV["WEBPACKER_HMR"].present?
val = ENV["WEBPACKER_HMR"].downcase
return true if val == "true"
return false if val == "false"
raise new ArgumentError("WEBPACKER_HMR value is #{ENV['WEBPACKER_HMR']}. Set to TRUE|FALSE")
Expand Down
13 changes: 6 additions & 7 deletions lib/webpacker/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ def stylesheet_pack_tag(*names, **options)
end

private
def asset_source(names, type)
ouput_path_or_url = Webpacker::Configuration.output_path_or_url
names.map do |name|
path = Webpacker::Manifest.lookup("#{name}#{compute_asset_extname(name, type: type)}")
"#{ouput_path_or_url}/#{path}"
def asset_source(names, type)
ouput_path_or_url = Webpacker::Configuration.output_path_or_url
names.map do |name|
path = Webpacker::Manifest.lookup("#{name}#{compute_asset_extname(name, type: type)}")
"#{ouput_path_or_url}/#{path}"
end
end
end

end
15 changes: 7 additions & 8 deletions lib/webpacker/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def missing_file_from_manifest_error(bundle_name)
raise(Webpacker::FileLoader::NotFoundError.new(msg))
end


def missing_manifest_file_error(path_object)
msg = <<-MSG
Webpacker can't find the manifest file: #{path_object}
Expand All @@ -91,12 +90,12 @@ def compile_and_find!(name)

private

def confirm_manifest_exists
raise missing_manifest_file_error(@path) unless File.exist?(@path)
end
def confirm_manifest_exists
raise missing_manifest_file_error(@path) unless File.exist?(@path)
end

def load_data
return super unless File.exist?(@path)
JSON.parse(File.read(@path))
end
def load_data
return super unless File.exist?(@path)
JSON.parse(File.read(@path))
end
end
1 change: 0 additions & 1 deletion test/manifest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def test_lookup_exception
end
end


def test_lookup_success
asset_file = "bootstrap.js"
assert_equal("bootstrap-300631c4f0e0f9c865bc.js", Webpacker::Manifest.lookup(asset_file))
Expand Down

0 comments on commit cf64c24

Please sign in to comment.