Module: StaticMatic::BuildMixin

### Home Classes Methods

### In Files

- lib/staticmatic/mixins/build.rb

### Methods

- #build
- #build_css
- #build_html
- #copy_file
- #generate_site_file
- #save_page
- #save_stylesheet

### Files

- LICENSE

### Class/Module Index

Quicksearch

- StaticMatic
- StaticMatic::Base
- StaticMatic::BuildMixin
- StaticMatic::Configuration
- StaticMatic::Error
- StaticMatic::Helpers
- StaticMatic::Helpers::AssetsHelper
- StaticMatic::Helpers::CurrentPathHelper
- StaticMatic::Helpers::FormHelper
- StaticMatic::Helpers::RenderHelper
- StaticMatic::Helpers::TagHelper
- StaticMatic::Helpers::UrlHelper
- StaticMatic::HelpersMixin
- StaticMatic::RenderMixin
- StaticMatic::RescueMixin
- StaticMatic::Server
- StaticMatic::ServerMixin
- StaticMatic::SetupMixin
- StaticMatic::TemplateError
- Compass
- Compass::AppIntegration
- Compass::AppIntegration::Staticmatic
- Compass::AppIntegration::Staticmatic::ConfigurationDefaults
- Compass::AppIntegration::Staticmatic::Installer

No matching classes.

# StaticMatic::BuildMixin

### Public Instance Methods

build() click to toggle source

    # File lib/staticmatic/mixins/build.rb, line 3
    def build
      build_css
      build_html
    end

build_css() click to toggle source

Build CSS from the source files

    # File lib/staticmatic/mixins/build.rb, line 18
    def build_css
      Dir["#{@src_dir}/stylesheets/**/*.{sass,scss}"].each do |path|
        file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\/stylesheets/, ''))

        if !template.match(/(^|\/)\_/)
          save_stylesheet(File.join(file_dir, template), generate_css(template, file_dir))
        end
      end
    end

build_html() click to toggle source

Build HTML from the source files

    # File lib/staticmatic/mixins/build.rb, line 9
    def build_html
      Dir["#{@src_dir}/pages/**/*.haml"].each do |path|
        next if File.basename(path) =~ /^\_/  # skip partials
        file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\/pages/, ''))
        save_page(File.join(file_dir, template), generate_html_with_layout(template, file_dir))
      end
    end

copy_file(from, to) click to toggle source

    # File lib/staticmatic/mixins/build.rb, line 28
    def copy_file(from, to)
      FileUtils.cp(from, to)
    end

generate_site_file(filename, extension, content) click to toggle source

    # File lib/staticmatic/mixins/build.rb, line 40
    def generate_site_file(filename, extension, content)
      path = File.join(@site_dir,"#{filename}.#{extension}")
      FileUtils.mkdir_p(File.dirname(path))
      File.open(path, 'w+') do |f|
        f << content
      end

      puts "created #{path}"
    end

save_page(filename, content) click to toggle source

    # File lib/staticmatic/mixins/build.rb, line 32
    def save_page(filename, content)
      generate_site_file(filename, 'html', content)
    end

save_stylesheet(filename, content) click to toggle source

    # File lib/staticmatic/mixins/build.rb, line 36
    def save_stylesheet(filename, content)
      generate_site_file(File.join('stylesheets', filename), 'css', content)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.