Skip to content

Commit c0056c4

Browse files
Merge pull request #44 from kenchan0130/fix-43
Fix #43
2 parents b8b8ddc + 540e6f3 commit c0056c4

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

lib/jekyll-minifier.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def output_html(path, content)
3939
if ( !opts.nil? )
4040
# Javascript Arguments
4141
js_args += opts[:uglifier_args] if opts.has_key?(:uglifier_args)
42-
42+
4343
# HTML Arguments
4444
html_args[:remove_spaces_inside_tags] = opts['remove_spaces_inside_tags'] if opts.has_key?('remove_spaces_inside_tags')
4545
html_args[:remove_multi_spaces] = opts['remove_multi_spaces'] if opts.has_key?('remove_multi_spaces')
@@ -63,7 +63,7 @@ def output_html(path, content)
6363
html_args[:preserve_patterns] += [/<\?php.*?\?>/im] if opts['preserve_php'] == true
6464
html_args[:preserve_patterns] += opts[:preserve_patterns].map { |pattern| Regexp.new(pattern)} if opts.has_key?(:preserve_patterns)
6565
end
66-
66+
6767
html_args[:css_compressor] = CSSminify2.new()
6868

6969
if ( !js_args.nil? )
@@ -95,7 +95,7 @@ def output_js(path, content)
9595
compressor = Uglifier.new()
9696
end
9797

98-
output_file(path, compressed.compile(content))
98+
output_file(path, compressor.compile(content))
9999
else
100100
output_file(path, content)
101101
end

spec/fixtures/_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<!--[if lt IE 9]><script src="//cdn.jsdelivr.net/g/html5shiv@3.7.3,respond@1.4.2" crossorigin="anonymous"></script><![endif]-->
2020
<link rel="stylesheet" href="{{ site.baseurl | prepend: site.url }}/assets/css/style.css">
2121
<link rel="alternate" type="application/atom+xml" title="Example.com" href="{{ site.baseurl | prepend: site.url }}/atom.xml">
22-
22+
<script type="text/javascript" src="{{ site.baseurl | prepend: site.url }}/assets/js/script.js"></script>
2323
</head>
2424
<body class="layout-reverse sidebar-overlay">
2525
{% include sidebar.html %}

spec/fixtures/assets/js/script.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
var sampleFunction = function() {
2+
console.log('This is sample.');
3+
};
4+
sampleFunction();

spec/jekyll-minifier_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
let(:site) { Jekyll::Site.new(config) }
2323
let(:context) { make_context(site: site) }
2424
before(:each) do
25+
allow(ENV).to receive(:[]).and_call_original
26+
allow(ENV).to receive(:[]).with('JEKYLL_ENV').and_return('production')
2527
site.process
2628
end
2729

0 commit comments

Comments
 (0)