• Like
Asset Pipeline for Perl
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Asset Pipeline for Perl

  • 2,668 views
Published

Plack::Middleware::Assets::RailsLike

Plack::Middleware::Assets::RailsLike

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,668
On SlideShare
0
From Embeds
0
Number of Embeds
15

Actions

Shares
Downloads
0
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Hokkaido.pm#10 LT @aloelight Asset Pipeline for Perl
  • 2. Asset Pipeline •複数のJavaScriptやCSSを結合して、 minifyしたりしてくれる機能 •CoffeeScript、Sass等を自動で変換 •Railsに標準搭載されている
  • 3. それっぽいの作りました Plack::Middleware::Assets::RailsLike github.com/ysasaki/p5-plack-middleware-assets-railslike
  • 4. 主な機能 •JavaScript, CSSの結合と最小化 •LESS, Sass/Scssの展開 •Cache •Pre-compile
  • 5. 使い方
  • 6. ディレクトリ構造 . ├── app.psgi ├── assets │ ├── main.css │ └── main.js └── static ├── css │ ├── div.css │ └── style.css └── js ├── alert.js ├── functions.js └── jquery-2.0.3.js Manifestファイル 読み込ませたいファイルを記載 読み込みたい普通のjs, cssファイル
  • 7. Manifest > cat assets/main.js //= require jquery-2.0.3 //= require functions //= require alert > cat assets/main.css /* *= require style *= require div */
  • 8. app.psgi use strict; use warnings; use Plack::Builder; builder { enable 'Assets::RailsLike', path        => qr{^/assets}, root        => '.', search_path => [ './static/js', './static/css' ]; $app; };
  • 9. DEMO
  • 10. Pre-compile > assets-railslike-precompiler.pl -v > --search-path static/js > assets/main.js Compiles assets/main.js => assets/ main-1078b9553ce7343a23b915716b84d68bf5c72d64.js
  • 11. DEMO