Last active
August 29, 2015 14:05
-
-
Save paulrobertlloyd/d74a56e5273df4256ea1 to your computer and use it in GitHub Desktop.
Rake task to concatenate CSS files
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
destination = 'public' | |
source = 'source' | |
desc "Concatenate CSS files" | |
task :concatenate_css do | |
files = FileList["#{source}/**/*.css"] | |
concatenated_filename = "#{destination}/stylesheets/styles.css" | |
File.open(concatenated_filename, "w") do |output| | |
files.each do |input| | |
puts "Reading #{input}" | |
output.write(File.read(input)) | |
output.write("\n") | |
end | |
end | |
end |
Have updated code with what I believe are the suggested changes, but this still doesn’t work! Output of the file is still a series of line breaks.
It works fine on my laptop. Delete the destination file and try again? Make sure you are not opening another file instead of the destination file.
Okay, sounds like I may be doing something stupid my end…!
I can confirm, I was doing something stupid! At some point during implementing these suggestions, the content in each of the source files was deleted. All working now, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And
file
assignment is unnecessary.