Created
October 7, 2014 22:08
-
-
Save stefanoverna/8667f36edaff9220d252 to your computer and use it in GitHub Desktop.
KSS
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 'kss' | |
styleguide = Kss::Parser.new('app/assets/stylesheets') | |
puts styleguide.sections | |
module Renderer | |
def self.render options = {} | |
assigns = options.delete(:assigns) || {} | |
view = view_class.new ActionController::Base.view_paths, assigns | |
view.extend ApplicationHelper | |
view.extend CustomHelper | |
view.render options | |
end | |
# Creates a subclass of ActionView::Base with route helpers mixed in. | |
def self.view_class | |
@view_class ||= Class.new ActionView::Base do | |
include Rails.application.routes.url_helpers | |
end | |
end | |
end | |
namespace :styleguide do | |
task :sync do | |
config = Rails.application.config.assets | |
# dir = File.join(Rails.public_path, config.prefix) | |
# puts Dir[dir + "/*"].join("\n") | |
manifest = Sprockets::Manifest.new( | |
ActionView::Base.assets_manifest.environment, | |
ActionView::Base.assets_manifest.dir | |
) | |
puts manifest.assets.inspect | |
puts manifest.files.inspect | |
end | |
end | |
if Rake::Task.task_defined?("assets:precompile:nondigest") | |
Rake::Task["assets:precompile:nondigest"].enhance do | |
Rake::Task["styleguide:sync"].invoke | |
end | |
else | |
Rake::Task["assets:precompile"].enhance do | |
Rake::Task["styleguide:sync"].invoke | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/rumblelabs/asset_sync