Created
August 13, 2013 21:55
-
-
Save roblafeve/6226112 to your computer and use it in GitHub Desktop.
A little Ruby script for generating a basic Sass scaffold
This file contains hidden or 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
folders = [ | |
'settings', | |
'effects', | |
'skin', | |
'typography', | |
'layout', | |
'module' | |
] | |
def writeFile(filename, text) | |
fout = File.open(filename, 'w') | |
fout.write(text) | |
fout.close | |
end | |
base_directory = ARGV[0] | |
if Dir.exist?(base_directory) | |
puts "Already exists :(" | |
else | |
Dir.mkdir(base_directory) | |
Dir.chdir(base_directory) | |
folders.each do |i| | |
Dir.mkdir(i) | |
Dir.chdir(i) | |
writeFile('base.scss', '') | |
Dir.chdir('..') | |
end | |
base_imports = "" | |
folders.each do |directory| | |
base_imports += "@import '#{directory}/*'\n" | |
end | |
remote_comment = "// Remote Imports\n\n" | |
local_comment = "// Local Imports\n" | |
content = remote_comment + local_comment + base_imports | |
writeFile('app.css.scss', content) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment