New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nanoc generates index.html under stylesheets folder #339

Closed
rubytastic opened this Issue Oct 4, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@rubytastic

rubytastic commented Oct 4, 2013

nanoc compile
Loading site data… done
Compiling site…
create [0.00s] ../public/blog/assets/images/logo_blog.png
create [0.11s] ../public/blog/assets/stylesheets/layout/index.html <== this should be layout .css
create [0.01s] ../public/blog/index.html
create [0.01s] ../public/blog/posts/2013-02-10-my-first-post/index.htm

Rules:

#!/usr/bin/env ruby

# A few helpful tips about the Rules file:
#
# * The string given to #compile and #route are matching patterns for
#   identifiers--not for paths. Therefore, you can’t match on extension.
#
# * The order of rules is important: for each item, only the first matching
#   rule is applied.
#
# * Item identifiers start and end with a slash (e.g. “/about/” for the file
#   “content/about.html”). To select all children, grandchildren, … of an
#   item, use the pattern “/about/*/”; “/about/*” will also select the parent,
#   because “*” matches zero or more characters.

unless defined? LOADED_DEFAULT_CONFIG
  LOADED_DEFAULT_CONFIG = true
  require 'compass'
  Compass.add_project_configuration 'compass/config.rb'
end

compile '/stylesheets/*/' do
  filter :sass, Compass.sass_engine_options
end

route '/stylesheets/*/' do
  item.identifier.chop + '.css'
end



compile '*' do
  if item.binary?
    # don’t filter binary items
  else
    filter :erb
    layout 'default'
  end
end

route '*' do
  if item.binary?
    # Write item with identifier /foo/ to /foo.ext
    item.identifier.chop + '.' + item[:extension]
  else
    # Write item with identifier /foo/ to /foo/index.html
    item.identifier + 'index.html'
  end
end

layout '*', :haml

compass/config.rb

# -----------------------------------------------
# Paths
# -----------------------------------------------

http_path       = "/"
images_dir      = "content/assets/images"
javascripts_dir = "content/assets/javascripts"
sass_dir        = "content/assets/stylesheets"

css_dir         = "../public/assets"

# -----------------------------------------------
# Output
# -----------------------------------------------

output_style      = :compressed
preferred_syntax  = :sass
relative_assets   = true

Is there any up2date bootstrap for nanoc + compass + haml + blog? Having much trouble getting haml and compass to work

@rubytastic

This comment has been minimized.

Show comment
Hide comment
@rubytastic

rubytastic Oct 4, 2013

Nevermind , Switched to middleman which seems to have compass out of the box and have more up2date documentation.

rubytastic commented Oct 4, 2013

Nevermind , Switched to middleman which seems to have compass out of the box and have more up2date documentation.

@rubytastic rubytastic closed this Oct 4, 2013

@bobthecow

This comment has been minimized.

Show comment
Hide comment
@bobthecow

bobthecow Oct 4, 2013

Member

Sorry to see you go :(

Here's why your stylesheet is getting the wrong name though:

compile '/stylesheets/*/' do
    filter :sass, Compass.sass_engine_options
end

route '/stylesheets/*/' do
    item.identifier.chop + '.css'
end

These rules don't actually match your stylesheet, so it's being compiled by the default rule — compile '*' at the bottom of your rules file — which compiles as identifier + index.html.

Your stylesheet lives at /assets/stylesheets/layout, and your rules match /stylesheets/*. You'd need to change those rules to /assets/stylesheets/* for it to work.

Member

bobthecow commented Oct 4, 2013

Sorry to see you go :(

Here's why your stylesheet is getting the wrong name though:

compile '/stylesheets/*/' do
    filter :sass, Compass.sass_engine_options
end

route '/stylesheets/*/' do
    item.identifier.chop + '.css'
end

These rules don't actually match your stylesheet, so it's being compiled by the default rule — compile '*' at the bottom of your rules file — which compiles as identifier + index.html.

Your stylesheet lives at /assets/stylesheets/layout, and your rules match /stylesheets/*. You'd need to change those rules to /assets/stylesheets/* for it to work.

@zorbash

This comment has been minimized.

Show comment
Hide comment
@zorbash

zorbash Jan 14, 2014

I think the documentation should be updated so that the quick start guide prevents issues like this. I'm willing to submit PR.

zorbash commented Jan 14, 2014

I think the documentation should be updated so that the quick start guide prevents issues like this. I'm willing to submit PR.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jan 14, 2014

Member

The default Rules should probably handle this in a better way. Providing sample routes for stylesheets (CSS and Sass/Less) along with the existing for binary items could do the trick.

I’ll reopen this issue so that I know something needs to be done about this. @zorbash Thanks for bringing it to my attention again!

Member

ddfreyne commented Jan 14, 2014

The default Rules should probably handle this in a better way. Providing sample routes for stylesheets (CSS and Sass/Less) along with the existing for binary items could do the trick.

I’ll reopen this issue so that I know something needs to be done about this. @zorbash Thanks for bringing it to my attention again!

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 20, 2014

Member

Fixed by #395.

Member

ddfreyne commented Feb 20, 2014

Fixed by #395.

@ddfreyne ddfreyne closed this Feb 20, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment