Class: Thoth::MinifyController

### Home Classes Methods

### In Files

- lib/thoth/controller/minify.rb

### Parent

Ramaze::Controller

### Methods

- #css
- #js

### Files

- robots.txt

### Class/Module Index

Quicksearch

- Thoth
- Thoth::AdminController
- Thoth::ArchiveController
- Thoth::Comment
- Thoth::CommentApiController
- Thoth::CommentController
- Thoth::Config
- Thoth::Error
- Thoth::Importer
- Thoth::MainController
- Thoth::Media
- Thoth::MediaController
- Thoth::MinifyController
- Thoth::Page
- Thoth::PageApiController
- Thoth::PageController
- Thoth::Pager
- Thoth::Plugin
- Thoth::Plugin::Delicious
- Thoth::Plugin::Flickr
- Thoth::Plugin::Tags
- Thoth::Plugin::Twitter
- Thoth::Post
- Thoth::PostApiController
- Thoth::PostController
- Thoth::SchemaError
- Thoth::SearchController
- Thoth::Tag
- Thoth::TagApiController
- Thoth::TagController
- Thoth::TagsPostsMap
- Ramaze
- Ramaze::Dispatcher
- Ramaze::Dispatcher::File
- Ramaze::Helper
- Ramaze::Helper::Admin
- Ramaze::Helper::Cookie
- Ramaze::Helper::Error
- Ramaze::Helper::Pagination
- Ramaze::Helper::Sanitize
- Ramaze::Helper::Wiki
- Ramaze::Helper::Ysearch
- Ramaze::Helper::Ysearch::SearchError
- AddMediaSize
- CreateSchema
- PantsImporter
- PoseidonImporter

No matching classes.

# Thoth::MinifyController

### Public Instance Methods

css(*args) click to toggle source

    # File lib/thoth/controller/minify.rb, line 35
    def css(*args)
      path = 'css/' << args.join('/')
      file = process(path)

      Ramaze::Session.current.drop! if Ramaze::Session.current

      response['Content-Type'] = 'text/css'

      # If the filename has a -min suffix, assume that it's already minified and
      # serve it as is.
      if (File.basename(path, '.css') =~ /-min$/)
        response.body = File.open(file, 'rb')
        throw(:respond)
      end

      if Config.server.enable_cache
        response.body = value_cache[path] ||
            value_cache[path] = CSSMin.minify(File.open(file, 'rb'))
      else
        response.body = CSSMin.minify(File.open(file, 'rb'))
      end

      throw(:respond)
    end

js(*args) click to toggle source

    # File lib/thoth/controller/minify.rb, line 60
    def js(*args)
      path = 'js/' << args.join('/')
      file = process(path)

      Ramaze::Session.current.drop! if Ramaze::Session.current

      response['Content-Type'] = 'text/javascript'

      # If the filename has a -min suffix, assume that it's already minified and
      # serve it as is.
      if (File.basename(path, '.js') =~ /-min$/)
        response.body = File.open(file, 'rb')
        throw(:respond)
      end

      if Config.server.enable_cache
        response.body = value_cache[path] ||
            value_cache[path] = JSMin.minify(File.open(file, 'rb'))
      else
        response.body = JSMin.minify(File.open(file, 'rb'))
      end

      throw(:respond)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.