Skip to content

Instantly share code, notes, and snippets.

@HustLion
Forked from parkr/generator_scss.rb
Last active August 29, 2015 14:25
Show Gist options
  • Save HustLion/02166cf3a938cbdeb661 to your computer and use it in GitHub Desktop.
Save HustLion/02166cf3a938cbdeb661 to your computer and use it in GitHub Desktop.

Revisions

  1. @parkr parkr revised this gist Jun 5, 2012. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions generator_scss.rb
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,6 @@
    # Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
    # Config file placed in ./_sass/config.rb
    #
    # NOTE: Currently does not function properly
    #

    require 'sass'
    require 'pathname'
  2. @parkr parkr revised this gist Jun 5, 2012. 1 changed file with 10 additions and 16 deletions.
    26 changes: 10 additions & 16 deletions generator_scss.rb
    Original file line number Diff line number Diff line change
    @@ -1,37 +1,31 @@
    #
    # Jekyll Generator for SCSS
    #
    # (File paths relative to jekyll project root directory)
    # (File paths in this description relative to jekyll project root directory)
    # Place this file in ./_plugins
    # Place .scss files in ./_scss
    # Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
    # Config file placed in ./_config/compass.rb
    # Config file placed in ./_sass/config.rb
    #
    # NOTE: Currently does not function properly
    #

    require 'sass'
    require 'pathname'
    require 'compass'
    require 'compass/exec'

    module Jekyll

    class CompassGenerator < Generator
    safe true

    def generate(site)
    # Read in SCSS files
    scss_files = Dir[File.expand_path('../_sass/**/*.scss', File.dirname(__FILE__))]
    puts "scss_files=(#{scss_files})"
    # Convert
    options = {
    :sass_files => scss_files,
    :configuration_file => File.expand_path('../_config/compass.rb', File.dirname(__FILE__))
    }
    working_path = '../'
    compass = Compass::Commands::UpdateProject.new(working_path, options)
    # compile and write output
    compass.perform
    Dir.chdir File.expand_path('../_sass', File.dirname(__FILE__)) do
    Compass::Exec::SubCommandUI.new(%w(compile)).run!
    end
    end

    end

    end
  3. @parkr parkr revised this gist Jun 5, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions generator_scss.rb
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,8 @@
    # Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
    # Config file placed in ./_config/compass.rb
    #
    # NOTE: Currently does not function properly
    #

    require 'compass'

  4. @parkr parkr revised this gist Jun 5, 2012. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions generator_scss.rb
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,13 @@
    #
    # Jekyll Generator for SCSS
    #
    # (File paths relative to jekyll project root directory)
    # Place this file in ./_plugins
    # Place .scss files in ./_scss
    # Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
    # Config file placed in ./_config/compass.rb
    #

    require 'compass'

    module Jekyll
  5. @parkr parkr created this gist Jun 5, 2012.
    25 changes: 25 additions & 0 deletions generator_scss.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    require 'compass'

    module Jekyll

    class CompassGenerator < Generator
    safe true

    def generate(site)
    # Read in SCSS files
    scss_files = Dir[File.expand_path('../_sass/**/*.scss', File.dirname(__FILE__))]
    puts "scss_files=(#{scss_files})"
    # Convert
    options = {
    :sass_files => scss_files,
    :configuration_file => File.expand_path('../_config/compass.rb', File.dirname(__FILE__))
    }
    working_path = '../'
    compass = Compass::Commands::UpdateProject.new(working_path, options)
    # compile and write output
    compass.perform
    end

    end

    end