Custom stylesheet names

233 views
Skip to first unread message

Ghola

unread,
Mar 6, 2012, 8:07:01 PM3/6/12
to compas...@googlegroups.com
Hey guys,

How do i achieve the following when compiling with compass?
1. Have custom names for the final css files
2. Merge print.css and screen.css (the browser will always request print.css even if it's not used for printing, so having it separate just adds an extra request -> information taken from html5 boilerplate) into one file.

My guess is that it has something to do with callbacks so this is what i tried so far:

on_stylesheet_saved do |filename| 
  if File.exists?(filename) 
    dir = File.dirname(filename) 
    new_name = "#{dir}/styles.css" 
   `cp #{filename} #{new_name}` 
  end 
end 

The problem is that it produces the following error:
Errno::ENOENT on line ["31"] of D: No such file or directory - cp D:/_Wamp/www/Project/stylesheets/default/./ie.css D:/_Wamp/www/Project/stylesheets/default/./styles.css
It clearly has something to do with the slashes and working in Windows, because the following path is valid (the files exists): D:\_Wamp\www\Project\stylesheets\default\.\ie.css

I am not a Ruby programmer so any help would be appreciated (this is my first contact with it). 

Leonardo Picado

unread,
Mar 7, 2012, 12:47:42 PM3/7/12
to compas...@googlegroups.com
Ghola

No need to complicate, just rename your scss files to whatever you want, when the compile/watch happens, that will output the amount of scss files you created (unless is a partial [those start with an underscore]).

So if you create a 'style.scss' file and inside that one import _screen.scss and _print.scss, you would end up with just a single style.css file



--
You received this message because you are subscribed to the Google Groups "Compass" group.
To view this discussion on the web visit https://groups.google.com/d/msg/compass-users/-/aJpHJUG3pFkJ.
To post to this group, send email to compas...@googlegroups.com.
To unsubscribe from this group, send email to compass-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/compass-users?hl=en.



--
Leonardo Picado: Advertiser | Programmer | UI Developer
www.leonardopicado.com  |  m...@leonardopicado.com

Reply all
Reply to author
Forward
0 new messages