Doing the SASS "Try it" with Compass?

37 views
Skip to first unread message

rdougan

unread,
Dec 23, 2010, 3:36:39 PM12/23/10
to Compass Development
RE: http://sass-lang.com/try.html

Has anyone done this with Compass, or can point me in the right
direction to do it? I'm thinking the only way would be to create a
temp file on the server, and then run the compass command and get the
result from the generated CSS file.

Does Compass have some methods I could call via Ruby itself, without
me digging through the source too much?

Thanks.

Chris Eppstein

unread,
Dec 23, 2010, 4:18:54 PM12/23/10
to compas...@googlegroups.com
It's pretty easy to render a string to css like this:

Sass::Engine.new(content, Compass.configuration.to_sass_engine_options).render

you will need to pass :syntax => :scss if it's an scss file.

chris


--
You received this message because you are subscribed to the Google Groups "Compass Development" group.
To post to this group, send email to compas...@googlegroups.com.
To unsubscribe from this group, send email to compass-devs...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/compass-devs?hl=en.


Robert Dougan

unread,
Dec 23, 2010, 4:21:10 PM12/23/10
to compas...@googlegroups.com
Yeah; the problem is including all the Compass frameworks so I can use them.

Chris Eppstein

unread,
Dec 23, 2010, 4:24:29 PM12/23/10
to compas...@googlegroups.com
That snippet will make all compass libraries available for import.

Brandon Mathis

unread,
Dec 23, 2010, 4:32:34 PM12/23/10
to compas...@googlegroups.com
So if you want, you can pre-populate your text entry field with @import "compass" to import all automatically imported modules.

- Brandon Mathis (via iPad)

Robert Dougan

unread,
Dec 23, 2010, 4:38:23 PM12/23/10
to compas...@googlegroups.com
Ah, I see. Awesome, got it working. Thanks.

Only remaining issue is importing my own SCSS extension. Can this be done easily, or should I just concat all the files together and put prepend it to the SCSS string?

Chris Eppstein

unread,
Dec 23, 2010, 4:45:51 PM12/23/10
to compas...@googlegroups.com
It's really no different than the compass libraries. You need to make sure your directory is on the load path:

Compass.configuration.add_import_path "path/to/extension/stylesheets"
Sass::Engine.new(content, Compass.configuration.to_sass_engine_options).render

And then either the user needs to import your library or you can prepend an import statement for them.

chris

Robert Dougan

unread,
Dec 23, 2010, 4:57:45 PM12/23/10
to compas...@googlegroups.com
Great, thank you. Got everything working as I needed.

Chris Eppstein

unread,
Dec 23, 2010, 4:58:54 PM12/23/10
to compas...@googlegroups.com
Great. Can't wait to see what you're making!

Brandon Mathis

unread,
Dec 23, 2010, 6:22:13 PM12/23/10
to compas...@googlegroups.com
Indeed, me too!

- Brandon Mathis (via iPhone)
Reply all
Reply to author
Forward
0 new messages