Sha256: f932dc7c2441b19b92865226d07057621bf6ca7fd222754364f123e4eb47129d

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

# plug :local_assets
# /compiled_asset/www/js/pjax.coffee
# /raw_asset/www/js/pjax.coffee
class Lux::Controller
  def lux_assets_plug

    # only allow clear in dev
    if Lux.page.no_cache?
      puts '* Clearing assets from ./tmp/assets'
      `rm -rf ./tmp/assets`
    end

    path = nav.path.join('/')

    if nav.root == 'compiled_asset'
      asset = MiniAsset.create(path)
      page.content_type asset.content_type
      page.body asset.compiled_data
    elsif nav.root == 'raw_asset'
      Lux.error "You can watch raw files only in development" unless Lux.dev?

      file = Lux.root.join('app/assets/%s' % path)
      body file.exist? ? file.read : "error: File not found"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lux-fw-0.1.17 ./lib/plugins/assets/assets_plug.rb