envygeeks / jekyll-assets Goto Github PK
View Code? Open in Web Editor NEW:art: Asset pipelines for Jekyll.
License: ISC License
:art: Asset pipelines for Jekyll.
License: ISC License
Is there a way to process assets that aren't specified by a liquid tag? I have, for example, background images in my SASS files and webfonts that aren't being processed.
When I use the following command inside a post body:
{% javascript app %}
The final html generate an unclosed script tag like this:
<script src="assets/javascript/app.js">
Disturbing all the following content.
Hey,
I just ran into some major problems with the liquid pre-processors..
https://github.com/ixti/jekyll-assets/blob/master/lib/jekyll/assets_plugin/environment.rb#L34
Basically it kills any script that has {{}} somewhere in the code.
Template interpolation get whiped out, template with {{ things }}
turs into template with
.
Angular.js source code breaks because it's literred with comments of illegal interpolations (according to liquid syntax)..
I saw you introduced this change here: #6
Was there any other reason for this? Why not use erb? Seems to do way more harm than good.
When defining a background-image url in a CSS file, the asset pipeline does not pick this up and won't cachebust neither gzip this file.
When adding the files in to /assets/images/ they get copied to /_site/ when building which make the CSS background-image work fine but still no GZip compression.
Can this be fixed? And how?
I one of my assets (main.css) I use jekyll-asset tags to link to other assets (in this case font files). Neither the tag nor its filter counterpart are parsed by liquid.
The section of css in question is:
@font-face {
font-family: 'Lacuna';
src: url('{% asset_path font/lacuna-webfont.eot %}');
src: url('{% asset_path font/lacuna-webfont.eot %}?#iefix') format('embedded-opentype'),
url('{% asset_path font/lacuna-webfont.woff %}') format('woff'),
url('{% asset_path font/lacuna-webfont.ttf %}') format('truetype'),
url('{% asset_path font/lacuna-webfont.svg %}#LacunaRegular') format('svg');
font-weight: normal;
font-style: normal;
}
which after a build looks like this:
@font-face {
font-family:'Lacuna';
src:url("{% asset_path font/lacuna-webfont.eot %}");
src:url("{% asset_path font/lacuna-webfont.eot %}?#iefix") format("embedded-opentype"),
url("{% asset_path font/lacuna-webfont.woff %}") format("woff"),
url("{% asset_path font/lacuna-webfont.ttf %}") format("truetype"),
url("{% asset_path font/lacuna-webfont.svg %}#LacunaRegular") format("svg");
font-weight:normal;
font-style:normal;
}
Furthermore, if I switch to using the filter instead, jekyll errors out and never completes the build.
This
@font-face {
font-family: 'Lacuna';
src: url('{{ 'font/lacuna-webfont.eot' | asset_path }}');
src: url('{% asset_path font/lacuna-webfont.eot %}?#iefix') format('embedded-opentype'),
url('{% asset_path font/lacuna-webfont.woff %}') format('woff'),
url('{% asset_path font/lacuna-webfont.ttf %}') format('truetype'),
url('{% asset_path font/lacuna-webfont.svg %}#LacunaRegular') format('svg');
font-weight: normal;
font-style: normal;
}
causes this:
$ jekyll build
Configuration file: /cygdrive/c/Users/Hans/git/hans.viessmann.co/_config.yml
Source: .
Destination: ./_site
Generating... Liquid Exception: Invalid CSS after ".../lacuna-webfont": expected ")", was ".eot' | asset_p..." (in /cygdrive/c/Users/Hans/git/hans.viessmann.co/_assets/stylesheets/main.css) in default
(sass):8
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:1148:in `expected'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/lexer.rb:199:in `expected!'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:476:in `assert_tok'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:332:in `funcall'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:319:in `ident'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:228:in `unary_not'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:228:in `unary_div'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:228:in `unary_minus'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:228:in `unary_plus'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:209:in `times_div_or_mod'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:209:in `plus_or_minus'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:209:in `relational'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:209:in `eq_or_neq'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:209:in `and_expr'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:209:in `or_expr'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:298:in `space'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:283:in `interpolation'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:246:in `expr'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:470:in `assert_expr'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/script/parser.rb:49:in `parse'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:1022:in `sass_script'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:882:in `value!'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:859:in `declaration'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:582:in `block in declaration_or_ruleset'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:1122:in `call'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:1122:in `rethrow'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:592:in `declaration_or_ruleset'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:554:in `block_child'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:546:in `block_contents'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:166:in `directive_body'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:158:in `directive'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:553:in `block_child'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:543:in `block_contents'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:82:in `stylesheet'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/scss/parser.rb:27:in `parse'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/engine.rb:342:in `_to_tree'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/engine.rb:315:in `_render'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.9/lib/sass/engine.rb:262:in `render'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/sass_compressor.rb:19:in `evaluate'
/usr/lib/ruby/gems/1.9.1/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/context.rb:197:in `block in evaluate'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/context.rb:194:in `each'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/context.rb:194:in `evaluate'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/bundled_asset.rb:25:in `initialize'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/base.rb:377:in `new'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/base.rb:377:in `build_asset'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/index.rb:94:in `block in build_asset'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/caching.rb:51:in `cache_asset'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/index.rb:93:in `build_asset'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/base.rb:287:in `find_asset'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/index.rb:61:in `find_asset'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.5.1/lib/jekyll/assets_plugin/patches/index_patch.rb:19:in `find_asset_with_jekyll'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/environment.rb:75:in `find_asset'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.5.1/lib/jekyll/assets_plugin/environment.rb:38:in `find_asset'
/usr/lib/ruby/gems/1.9.1/gems/sprockets-2.9.3/lib/sprockets/base.rb:295:in `[]'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.5.1/lib/jekyll/assets_plugin/patches/site_patch.rb:43:in `asset_path'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.5.1/lib/jekyll/assets_plugin/renderer.rb:21:in `render_asset_path'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.5.1/lib/jekyll/assets_plugin/renderer.rb:35:in `render_stylesheet'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.5.1/lib/jekyll/assets_plugin/tag.rb:14:in `render'
/usr/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/block.rb:106:in `block in render_all'
/usr/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/block.rb:93:in `each'
/usr/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/block.rb:93:in `render_all'
/usr/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/block.rb:82:in `render'
/usr/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/template.rb:124:in `render'
/usr/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/template.rb:132:in `render!'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/convertible.rb:77:in `render_liquid'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/convertible.rb:101:in `render_all_layouts'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/convertible.rb:136:in `do_layout'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/post.rb:285:in `render'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/site.rb:230:in `block in render'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/site.rb:229:in `each'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/site.rb:229:in `render'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/site.rb:44:in `process'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/command.rb:18:in `process_site'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/commands/build.rb:23:in `build'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/lib/jekyll/commands/build.rb:7:in `process'
/usr/lib/ruby/gems/1.9.1/gems/jekyll-1.0.2/bin/jekyll:59:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
/usr/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
/usr/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:155:in `run'
/usr/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/runner.rb:402:in `run_active_command'
/usr/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/runner.rb:66:in `run!'
/usr/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/delegates.rb:11:in `run!'
/usr/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/import.rb:10:in `block in <top (required)>'
Build Failed
My Gemfile.lock:
$ cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
colorator (0.1)
commander (4.1.3)
highline (~> 1.6.11)
directory_watcher (1.4.1)
execjs (1.4.0)
multi_json (~> 1.0)
fast-stemmer (1.0.2)
highline (1.6.18)
hike (1.2.2)
jekyll (1.0.2)
classifier (~> 1.3)
colorator (~> 0.1)
commander (~> 4.1.3)
directory_watcher (~> 1.4.1)
kramdown (~> 1.0.2)
liquid (~> 2.3)
maruku (~> 0.5)
pygments.rb (~> 0.5.0)
safe_yaml (~> 0.7.0)
jekyll-assets (0.5.1)
jekyll (~> 1.0)
sprockets (~> 2.9)
kramdown (1.0.2)
liquid (2.5.0)
maruku (0.6.1)
syntax (>= 1.0.0)
multi_json (1.7.3)
posix-spawn (0.3.6)
pygments.rb (0.5.0)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rack (1.5.2)
rdiscount (2.0.7.3)
safe_yaml (0.7.1)
sass (3.2.9)
sprockets (2.9.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
syntax (1.0.0)
tilt (1.4.1)
uglifier (2.1.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
jekyll
jekyll-assets
rdiscount
sass
uglifier
I tried to upgrade sass 3.2.9 to 3.3.0-alpha (to have sourcemap functionality enabled on Chrome) but when I compile I get this output
> jekyll build --config _config.yml,_config_dev.yml --trace Configuration file: _config.yml
Configuration file: _config_dev.yml
Source: ./src
Destination: ./dev
Generating... Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/common-ie8.css.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/common.css.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_variables.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_layout.css.scss.erbc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_mixins.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_normalize.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_print.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/common.css.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_variables.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_layout.css.scss.erbc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_mixins.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_normalize.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_print.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
done.
I've already tried to delete and recreate .sass-cache
folder with full permissions but no luck.
I've also a plugin jekyll-asset.rb
in which I've disabled the cache
require "jekyll-assets"
require "yui/compressor"
require "sprockets/sass"
require "sprockets/sass/functions"
module Sprockets
class SassCompressor
def evaluate(context, locals, &block)
::Sass::Engine.new(data, {
:syntax => :scss,
:cache => true,
:line_numbers => true,
:style => :expanded
}).render
end
end
end
class Jekyll::AssetsPlugin::Renderer
remove_const :STYLESHEET
remove_const :JAVASCRIPT
STYLESHEET = '<link rel="stylesheet" href="%s" />'
JAVASCRIPT = '<script src="%s"></script>'
end
but still it doesn't work. The same problem If I use sass 3.2.11
What could it be the problem?
Thank you
To add a Compass config file config.rb
I have added following line to _plugins/ext.rb
Compass.add_project_configuration('config.rb')
All the changes of the configuration settings seems to be set to Compass
, because after that line I can print a new added configuration such as
puts "Compass.configuration.disable_warnings: #{Compass.configuration.disable_warnings}"
However, none of the settings defined in config.rb
are used by jekyll-assets (or maybe by Sprockets?) It seems that there are overridden. Any idea?
Thanks!
In an Octopress installation, the stylesheets are stored outside of the source folder in a folder called sass. When rake generate
is called, it triggers a compass compile directive:
compass compile --css-dir #{source_dir}/_assets/stylesheets
In these stylesheets I use tags like
background-image: url('{% asset_path foo.jpg %}');
I have setup jekyll-assets to scan the _assets/stylesheets
folder where is correctly finds and loads the compass-generated stylesheet. However, the '{% asset_path foo.jpg %}
never gets interpretted and is printed to the css file as such.
Reading through some of the previous closed issues on the site I was under the impression that this was possible. Have I setup something wrong?
Would be nice if this could be configured, or was off by default.
Gotta save those bytes where we can :)
Need to find a way to support sprite-map
feature of Compass, see discussion of #4 for details.
When I am using the "jekyll server --auto" command and I change any .scss file, I need to rebuild the all application to see It take effect
Similar to the asset-sync gem, I would be pretty sweet to have assets auto-uploaded to s3, then use the s3 domain name + file instead of the local file.
Let's say that I have some CSS in _assets/stylesheets/styles.css which looks like this:
---
---
#header {
background-image: /images/mybackground.png
}
But now I move that image into _assets as well. I need my CSS to be able to reference the cache-busted version:
---
---
#header {
background-image: {% asset_path mybackground.png %}
}
But this doesn't seem to work? Even though the CSS file has a yaml header, it doesn't get processed, apparently because it's in _assets? Is there a correct way to do this?
In my layout I've included my stylesheet common.css.scss
in this way
<!--[if gt IE 8]><!-->{% stylesheet common %}<!--<![endif]-->
and this correctly generates
<!--[if gt IE 8]><!--><link rel="stylesheet" href="/assets/common.css?cb=094e764b8130638a5ad5f3bfa0efe705" /><!--<![endif]-->
Now, in my SCSS file I'd like to have the capabilty to also import some css file (not the sass @import, I'm talking about the CSS2.1 @import
directive), e.g.
@import url(homepage.css);
@import url(welcomepage.css);
because the templates I'm working on will be integrated later in some kind of CMS and the system integrator asked me to have on single css file with all clean inclusions. So I tried this approach, creating my homepage.css.scss
and welcomepage.css.scss
but these files are neither compiled nor copied into my destination folder.
Don't know if a different solution exists or if this can be an improvement for your plugin: right now I'm just using the SASS @import but this "explodes" all the content of several sass in one single file (the common.css)
Thank you.
I want to compile Sass with source-maps for development mode and with --output-style=compact
for production. Any examples of how to do it with jekyll-assets?
Hello hello
I'm not sure what is the issue. The problem I have appeared today. before it was all fine.
When I run Jekyll with my app.js.coffee i now get an error:
WARN: tilt autoloading 'coffee_script' in a non thread-safe way; explicit require 'coffee_script' suggested.
and the site doesn't compile anymore.
Is there a way to require coffeescript. I tried by adding
require "coffee_script"
in ext.rb
but it doesn't work
I tried to use this plugin with the folder structure you published here: https://github.com/ixti/jekyll-assets-demo
but when I regenerate static files I've got this error
Configuration from /Users/fcalderan/www/root/jky/_config.yml
Building site: /Users/fcalderan/www/root/jky -> /Users/fcalderan/www/root/jky/_site
Liquid Exception: undefined method `singleton_class' for #<Sprockets::Index:0x10230ff68> in default
/Library/Ruby/Gems/1.8/gems/jekyll-assets-0.3.4/lib/jekyll/assets_plugin/environment.rb:55:in `index'
/Library/Ruby/Gems/1.8/gems/jekyll-assets-0.3.4/lib/jekyll/assets_plugin/environment.rb:55:in `tap'
...
default.html
is the name of my layout file and base.css
the css file. The problem disappear when I remove
{% stylesheet base %}
from layout file (but of course no style is included).
I've currently installed
I've used the same Gemfile of the demo, but I have no idea what could be the problem. Have you any clue about it?
Thank you
I’m trying to make Compass work. It fails with an error.
jekyll-assets 0.7.0
jekyll 1.0.3
plugins/jekyll-assets.rb
require "jekyll-assets"
require "jekyll-assets/compass"
default.html:
...
{% stylesheet main %}
...
_config.yml
assets:
dirname: assets
baseurl: /assets/
sources:
- _assets/sass
debug: true
css_compressor: 'sass'
_assets/sass/main.scss
@import "compass";
...
➤ bundle exec jekyll serve --watch --trace
Configuration file: /Users/nv/Sites/n12v.com/_config.yml
Source: source
Destination: public
Generating... /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.7.0/lib/jekyll/assets_plugin/patches/site_patch.rb:53:in `uniq!': can't convert String into Integer (TypeError)
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/jekyll-assets-0.7.0/lib/jekyll/assets_plugin/patches/site_patch.rb:53:in `__wrap_write'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/jekyll-1.0.3/lib/jekyll/site.rb:46:in `process'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/jekyll-1.0.3/lib/jekyll/command.rb:18:in `process_site'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/jekyll-1.0.3/lib/jekyll/commands/build.rb:23:in `build'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/jekyll-1.0.3/lib/jekyll/commands/build.rb:7:in `process'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/jekyll-1.0.3/bin/jekyll:85:in `block (2 levels) in <top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:155:in `run'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/runner.rb:402:in `run_active_command'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/runner.rb:78:in `run!'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/delegates.rb:11:in `run!'
from /usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/import.rb:10:in `block in <top (required)>'
So, using the config.ru
inclusion to serve assets dynamically, requests for say, /assets/some_dir/foo.png
work fine. However, when generating the site statically, only images from source/_assets/images
are copied -- not source/_assets/images/some_dir
.
The relevant portion of my config.ru:
$root = ::File.dirname(__FILE__)
require File.expand_path(File.join($root, 'plugins/assets'))
map "/assets" do
environment = Sprockets::Environment.new
environment.append_path "source/_assets/stylesheets"
environment.append_path "source/_assets/javascripts"
environment.append_path "source/_assets/images"
environment.append_path "source/_assets/fonts"
run environment
end
And the relevant portion of my assets.yml (compiled by Octopress into _config.yml):
---
assets:
#
# Pathname of the destination of generated (bundled) assets relative
# to the destination of the root.
#
dirname: assets
#
# Base URL of assets paths.
#
baseurl: /assets/
#
# Pathnames where to find assets relative to the root of the site.
#
sources:
- _assets/javascripts
- _assets/stylesheets
- _assets/images
- _assets/fonts
#
# Compression/minification tools.
#
compress:
js: uglifier
css: sass
#
# CDN URL.
#
# baseurl: //my.super-cool-cdn.com/
#
# Cache-busting.
# Options are:
# none - no cachebuster added to URL.
# soft - filename is left alone, but ?cb=<x> is added via asset path helpers.
# hard - filename is modified with checksum.
#
cachebust: none
I'm almost certain that this is more a question for the Sprocket folks, but I'm also inexperienced enough with Ruby to feel the need to ask at the highest point in my stack.
We're currently using retinajs for serving up double-sized assets to high-resolution screens, however migrating to jekyll-assets and using asset_path
has left us with no copied @2x
images in the resulting compiled site, since of course jekyll-assets thinks they're not being used anywhere.
Is there any immediate quick-and-easy way to extend jekyll-assets+Sprocket to look for and copy these unreferenced files? I see that jekyll-assets is eminently patchable, I just don't know Ruby enough to know what to do with that information.
I wonder if it's possible to to add custom paths to the Sprockets::Environment? I'm using handlebars_assets, and I want to be able to do this:
env.append_path HandlebarsAssets.path
Possible?
I enabled sass for my stylesheets in _config.yml
, and I started my server with --auto
option, but every time I change a .css.scss
file, I need to save it twice in order to see my css updated on the static copy even if webrick detected a change. Not a real problem but it's really an annoying behaviour.
Don't know if this issue could be related to this plugin, but there's a way to overcome the problem and avoid to save the sass file one more time?
Thank you
It would be great if there was an option to generate both a regular asset and a cache-busted asset.
I'm using my site programatically and I need to know the location of particular assets beforehand.
I could set cachebust
to none
and be done with it, but I like cache bustin'.
I'm using a font for icons and would like to include the different variants of the font in my assets folder (.svg, .eot, .ttf, .woff).
I tried adding sources: _assets/fonts
to my _config.yml file and that didn't work. I also tried adding a custom vendor via the plugin. I don't think I'm doing this right.
I need jekyll-assets to include the fonts directory so that I can reference it in my scss. Thanks.
If I have an _assets/stylesheets/ folder, and I have 2 files:
red.scss
@import "blue.css";
body { background: red }
blue.scss
body { color: blue }
And I add the red stylesheet to the head in a jekyll liquid template:
<html>
<head>
{% stylesheet red %}
</head>
<body>This is a test</body>
<html>
The red.scss file is included fine, but it still has the @import statement in it, and it neither compiles blue.scss, nor includes it inline. This is breaking everything from bootstrap to some custom existing stuff.. What am I missing, or is something broken?
I'm including these gems via bundler...
Gems included by the bundle:
Using the exact same methods previously used for a jekyll site and jekyll-assets, the assets for the following project are not compiling into the _site directory.
Is this related to the sass 3.2.9 issue?
Generated code by using the Compass extension breakpoint is duplicated.
Sass code (based on this breakpoint example):
$breakpoint-medium-width: 500px
$breakpoint-medium-not-wide: 500px 700px
$breakpoint-medium-height: 300px 700px 'height'
.foo
@include breakpoint($breakpoint-medium-width)
content: 'medium widths'
.baz
@include breakpoint($breakpoint-medium-not-wide)
content: 'medium, but not too wide'
.tgif
@include breakpoint($breakpoint-medium-height)
content: 'medium heights'
Generated code (note the duplicated @media parameters):
@media (min-width: 500px), (min-width: 500px) {
.foo {
content: "medium widths"; } }
@media (min-width: 500px) and (min-width: 700px), (min-width: 500px) and (min-width: 700px) {
.baz {
content: "medium, but not too wide"; } }
@media (min-width: 300px) and (min-width: 700px) and (height), (min-width: 300px) and (min- width: 700px) and (height) {
.tgif {
content: "medium heights"; } }
The source of the plugin is pointed in my _plugins/ext.rb
:
breakpoint_dir = Gem::Specification.find_by_name("breakpoint").gem_dir
Sprockets.append_path File.join(breakpoint_dir, "stylesheets")
My current setup:
jekyll-assets (0.3.0)
Jekyll 0.12.0
Sass 3.2.5 (Media Mark)
breakpoint (1.3)
The same issue occurs if I use the Compass extension respond-to, which is build on breakpoint
I'm not sure if this an issue of 'jekyll-assets' or 'breakpoint' ('respond-to'). At the breakpoint page you will find a similar issue, which is closed because it is caused by ScoutApp.
Maybe an issue caused by Sprockets...? Any idea?
Thanks!
-Jens
I love the auto generated gzip functionality for css and js files, but have issues linking to the gzipped version of the file. My site runs on Apache.
On Twitter @ixti suggested to use a filter...
{{ app.js | asset_path | append:".gz" }}
... but a tag like this would be more versatile imo.
{% stylesheet style .gz %}
Good somebody work this out?
Cheers
I have configured the gem to process the static assets on my Octopress blog, and everything is working great with stylesheets, javascripts, and images.
However, I have other static content that is consistently ignored no matter what I try.
Here is my configuration:
assets:
dirname: website/assets/
sources:
- _assets/images
- _assets/fancybox
- _assets/javascripts
- _assets/jwplayer
- _assets/stylesheets
- _assets/fonts
compress:
js: 'uglifier'
css: 'sass'
cachebust: hard
gzip: [ text/css, application/javascript ]
Nothing in fancybox, jwplayer, or fonts is moved to the website/assets folder.
How can I change my configuration so that everything is processed? Or is this a bug?
Thanks.
_assets/javascripts/main.js
//= require bootstrap/bootstrap
_assets/javascripts/bootstrap/bootstrap.js
//= require bootstrap/bootstrap/transition
//= require bootstrap/bootstrap/alert
//= require bootstrap/bootstrap/button
//= require bootstrap/bootstrap/carousel
// ...
Error happens when some asset is referenced from another (image from css) with asset_path
helper.
It would be great if you could define a JavaScript to be loaded asynchronously...
<script async type="text/javascript" src="/assets/app-e11efcdf30942a4f025d8093f5729ab3.js"></script>
Jekyll throws the following error when trying to include a partial that's named .scss.erb.
Generating... Liquid Exception: File to import not found or unreadable: sections/contact-form. Load paths: (... and here's all the assets paths...)
I can rename the main app.scss with an erb extension and it processes Ruby code just fine, but I can't figure out how to @import the partial. I also tried renaming the main SCSS file with a .erb extension to see if that would effect parsing but it's still throwing the same error. It can't find the partial in the paths if you give it a .erb extension.
I'm doing a workaround now by using the asset_path() helper but I see this being a problem in the future.
When configuring Sprockets::Sass to add line comments in the generated .css file, the asset_path function breaks.
Adding a plugin like this:
require "sprockets/sass"
Sprockets::Sass.options[:line_comments] = true
works fine and comments like:
/* line 250, /_assets/stylesheets/foundation/components/_orbit.scss */
is added in the generated CSS file which makes it much easier to track when developing.
However no
asset_path( *path* )
is translated so the page is completely without assets. I reckon this might be a quite easy fix or perhaps adding an
assets:
line_comments: true
would be even better!
(If I knew how to do it I would already given you a fork)
Hi,
first of all this also could be just an issue because I am not very familiar with Ruby, but when I build my site the settings for thr jekyll-assets
plugin get completely ignored.
The liquid tags work and files reference by the tags get copied to the build directory. But my settings (see below) are ignored:
permalink: /:categories/:title.html
exclude: [scss, Gemfile, Gemfile.lock]
include: [.htaccess]
safe: false
assets:
cache: false
sources:
- _assets/inmg
- _assets/js
- _assets/css
- _assets/fonts
I am very confused and have no clue what I am doing wrong, because the plugin works just all settings are getting ignored :(
EDIT: Also, {{ site.assets }}
works and displays all settings.
BTW I am building the site on my Windows machine.
Missing:
Just learning about Jekyll-assets, so maybe this is detailed somewhere, but can you offer any advice on using Compass extensions, such as Breakpoint, with Jekyll-assets?
Using liquid tags asset_path, javascript, stylesheet on assets that were not bundled, it's better bundle them instead of "warning".
This line breaks jekyll-assets
on ruby version below 1.9, as they did not have the empty? method on symbols:
https://github.com/ixti/jekyll-assets/blob/master/lib/jekyll/assets_plugin/configuration.rb#L84
Hello there, if I have Uglifier set as the compressor, comments that contain licensing information at the top of the file are being removed. Take, for example, Modernizr:
/* Modernizr 2.5.3 (Custom Build) | MIT & BSD
* Build: http://www.modernizr.com/download/#-cssclasses-load
*/
Or jQuery:
/*! jQuery v1.7.2 jquery.com | jquery.org/license */
Is there a configuration setting I'm missing? When I run Uglifier normally it keeps the comments around. Thank you very much for the wonderful library.
Hi ixti,
I've created a mixin:
@mixin font-face($nick, $name, $file, $weight: normal, $style: normal){
@font-face {
font-family: $nick;
src: url(asset_path("#{$file}.eot"));
src: url(asset_path("#{$file}.eot?#iefix")) format('embedded-opentype'),
url(asset_path("#{$file}.woff")) format('woff'),
url(asset_path("#{$file}.ttf")) format('truetype'),
url(asset_path("#{$file}.svg##{$name}")) format('svg');
font-weight: $weight;
font-style: $style;
}
}
However, when I build the site I get the following error:
Liquid Exception: Couldn't find file 'font/lacuna-webfont.eot?#iefix' (in /cygdrive/c/Users/Hans/git/hans.viessmann.co/_assets/stylesheets/main.css.scss) in default.html
I just recently updated to 0.6.0, have there been any changes in how asset_path works?
Thanks
Jekyll Assets is great but, I would like to be able to change some things such as:
STYLESHEET = '<link rel="stylesheet" type="text/css" href="%s">'
Is it possible to be done extending / overriding in the _plugin
? If yes, what is the best approach?
I also would like to use the {% asset_path test.jpg %}
without renaming the file to MD5. Is there any config option to disable it?
Can this be done - sstephenson/sprockets#88 ???
It's nice to have MIME-type specific helpers available in Liquid:
<img src="{% image_path bg %}" />
when auto:true is set in config and you edit only a post or layout file it will regenerate into _site but without images!
I encountered and error when trying to use Font Awesome, this is however a more general bug I believe relating to the asset_path
method.
The following is the code I used, edited to take advantage of font-path()
. This code fails because it is looking for a filename that includes the query string. Removing everything after the ?
will not throw any errors.
@font-face {
font-family: 'FontAwesome';
src: url(font-path('fontawesome-webfont.eot?v=3.0.1'));
src: url(font-path('fontawesome-webfont.eot?#iefix&v=3.0.1')) format("embedded-opentype"),
url(font-path('fontawesome-webfont.woff?v=3.0.1')) format("woff"),
url(font-path('fontawesome-webfont.ttf?v=3.0.1')) format("truetype");
font-weight: normal;
font-style: normal;
}
This is not a problem only for this plugin, I found this issue in the Rails repo that proposes a simple solution.
If there is a work around other than this update that I'm missing please let me know!
Would this feature make sense?
{% stylesheet http://some-stylesheet.css %}
{% image http://some-image.jpg %}
...
This should allow us use asset_path
helpers without ERB in JS/CSS assets like this:
# file: app.js.coffee
yepnope.load '{% asset_path app.css %}'
/* file: app.css */
body {
background-image: url({% asset_path bg.png %});
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.