Last active
January 2, 2016 01:09
-
-
Save jeremy-green/8228607 to your computer and use it in GitHub Desktop.
use package.json to add more configuration goodness to sass
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 any additional compass plugins here. | |
require "json" | |
# Set this to the root of your project when deployed: | |
# Drupal - http_path = "/sites/all/themes/#{THEME_FOLDER}/" | |
# Wordpress - http_path = "/wp-content/themes/#{THEME_FOLDER}/" | |
THEME_FOLDER = File.basename(File.dirname(__FILE__)) | |
http_path = "/" | |
css_dir = "css" | |
sass_dir = "sass" | |
images_dir = "img" | |
javascripts_dir = "js" | |
fonts_dir = "fonts" | |
# To enable relative paths to assets via compass helper functions. Since Drupal | |
# themes can be installed in multiple locations, we don't need to worry about | |
# the absolute path to the theme from the server root. | |
relative_assets = true | |
# To disable debugging comments that display the original location of your selectors. Uncomment: | |
line_comments = false | |
# If you prefer the indented syntax, you might want to regenerate this | |
# project again passing --syntax sass, or you can uncomment this: | |
# preferred_syntax = :sass | |
# and then run: | |
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass | |
# Change this to :production when ready to deploy the CSS to the live server. | |
environment = :development | |
#environment = :production | |
# In development, we can turn on the debug_info to use with FireSass or Chrome Web Inspector. | |
debug = false | |
#debug = true | |
# Disable cache busting on image assets | |
asset_cache_buster :none | |
if environment == :production | |
line_comments = false | |
output_style = :compressed | |
sourcemap = false | |
debug = false | |
disable_warnings = true | |
else | |
line_comments = true | |
sourcemap = true | |
debug = true | |
output_style = :expanded | |
end | |
# Pass options to sass. For development, we turn on the FireSass-compatible | |
# debug_info if the debug config variable above is true. | |
sass_options = (environment == :development && debug == true) ? {:debug_info => true} : {} | |
$json = JSON.parse( IO.read( THEME_DIR + "/package.json") ) | |
module Sass::Script::Functions | |
def theme_description() | |
Sass::Script::String.new($json["description"]) | |
end | |
def theme_name() | |
Sass::Script::String.new($json["name"]) | |
end | |
def theme_version() | |
Sass::Script::String.new($json["version"]) | |
end | |
end | |
on_stylesheet_saved do |filename| | |
result = JSON.parse(open("http://www.iheartquotes.com/api/v1/random?format=json").read) | |
puts result["quote"] | |
end |
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
{ | |
"name": "Project Name", | |
"version": "0.0.1", | |
"description": "The Project Description", | |
"homepage": "http://www.project-name.com", | |
"repository": { | |
"type": "git", | |
"url": "git-repo-url" | |
}, | |
"author": { | |
"name": "Author", | |
"url": "http://author-name.com" | |
}, | |
"devDependencies": { | |
"grunt": "~0.4.1", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment