Skip to content

Commit

Permalink
Added configuration allowing users to configure destination directori…
Browse files Browse the repository at this point in the history
…es for asset-pipeline javascripts and stylesheets. Fixes octopress/asset-pipeline#17
  • Loading branch information
imathis committed Jul 27, 2015
1 parent 821cdac commit 3e2d8b6
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/octopress-ink/configuration.rb
Expand Up @@ -10,7 +10,9 @@ module Ink
'compress_js' => true,
'uglifier' => {},
'async_css' => false,
'async_js' => true
'async_js' => true,
'stylesheets_destination' => 'stylesheets',
'javascripts_destination' => 'javascripts',
},

'date_format' => 'ordinal',
Expand Down
6 changes: 4 additions & 2 deletions lib/octopress-ink/plugin_asset_pipeline.rb
Expand Up @@ -13,6 +13,8 @@ def reset
@stylesheet_fingerprint = {}
@javascript_fingerprint = nil
@uglify_settings ||= Jekyll::Utils.symbolize_hash_keys(Ink.configuration['asset_pipeline']['uglifier'])
@css_dir = Ink.configuration['asset_pipeline']['stylesheets_destination']
@js_dir = Ink.configuration['asset_pipeline']['javascripts_destination']
end

# Compile CSS to take advantage of Sass's compression settings
Expand Down Expand Up @@ -143,7 +145,7 @@ def write_combined_stylesheet
end

def combined_stylesheet_path(media)
File.join('stylesheets', "#{media}-#{stylesheet_fingerprint(media)}.css")
File.join(@css_dir, "#{media}-#{stylesheet_fingerprint(media)}.css")
end

def stylesheet_fingerprint(media)
Expand Down Expand Up @@ -181,7 +183,7 @@ def javascript_fingerprint
end

def combined_javascript_path
File.join('javascripts', "all-#{javascript_fingerprint}.js")
File.join(@js_dir, "all-#{javascript_fingerprint}.js")
end

def write_combined_javascript
Expand Down
11 changes: 11 additions & 0 deletions test/_clash.yml
Expand Up @@ -51,6 +51,17 @@
- _async_css.yml
compare:
- _expected/async_css/asset_tag.html _site/asset_tag.html
-
title: Should build stylesheets and javascripts to css and js directories
dir: standard
build: true
config:
jekyll:
- _config.yml
- _configure_asset_destination.yml
compare:
- _expected/configure_asset_destination/css _site/css
- _expected/configure_asset_destination/js _site/js
-
title: Should allow multilingual configuration
dir: multilingual
Expand Down
3 changes: 3 additions & 0 deletions test/standard/_configure_asset_destination.yml
@@ -0,0 +1,3 @@
asset_pipeline:
javascripts_destination: js
stylesheets_destination: css
@@ -0,0 +1 @@
body{margin:2px;padding:2px}.main{color:#444}body{background:#bcbcbc}.plugin-widget{background:red;color:#fff}
@@ -0,0 +1 @@
*{background:none;color:#000}article a:after{content:attr(href)}
@@ -0,0 +1,8 @@
/* Theme: Classic Theme */
console.log("bar");console.log("omg");console.log("this should not be minifed")
//There should be

//A space there ^

// and there
(function(){console.log("dang")}).call(this);

0 comments on commit 3e2d8b6

Please sign in to comment.