This gist is no longer valid. Please see Compass-Rails for instructions on how to install.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@include keyframes(appear-and-roundify) { | |
0% { opacity: 0; @include border-radius(2px); } | |
100% { opacity: 1; @include border-radius(10px); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%bordered { | |
.section & { | |
border: 1px solid #ccc; | |
} | |
} | |
.sidebar .quotation { | |
@extend %bordered; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# extracts dependencies for a file | |
class DependencyExtractor | |
class Asset < Struct.new(:filename, :importer, :children) | |
def initialize(*args) | |
super | |
self.children ||= [] | |
end | |
# transitive dependencies. Call `children` for just the immediate dependencies. | |
def dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A named buffer. Will append to existing content captured there. | |
// The buffer can be accessed via get-capture("foo") or @emit "foo". | |
@capture "foo" { | |
@media screen { | |
.asdf { | |
.qwerty { | |
/* This is a comment */ | |
color: red; | |
} | |
} |
$ compass compile --environment production && compass compile
Afterwards you will have both the minified and non-minified versions in your output folder. Note that compass clean
will not clean up your minified files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
url = ARGV[0] | |
class Document < Nokogiri::XML::SAX::Document | |
SEMANTIC_CONTAINERS = %w(body article section nav aside hgroup header footer) | |
COUNT_ELEMENTS = %w(p a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "chunky_png" | |
require "base64" | |
module Sass::Script::Functions | |
def background_noise(c, noise = 0.5, opacity = 0.08, size = 200, mono = false) | |
# Convert SASS numbers to Ruby classes | |
noise = noise.to_s.to_f if noise.is_a? Sass::Script::Number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin ie6 { * html & { @content } } | |
#logo { | |
background-image: url("/images/logo.png"); | |
@include ie6 { background-image: url("/images/logo.gif"); } | |
} |
In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.
For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.