├── .gitignore ├── pug.rb ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | coverage 6 | InstalledFiles 7 | lib/bundler/man 8 | pkg 9 | rdoc 10 | spec/reports 11 | test/tmp 12 | test/version_tmp 13 | tmp 14 | 15 | # YARD artifacts 16 | .yardoc 17 | _yardoc 18 | doc/ 19 | -------------------------------------------------------------------------------- /pug.rb: -------------------------------------------------------------------------------- 1 | ## 2 | ## This Plugin enables Pug support to pages and posts. 3 | ## 4 | 5 | require 'open3' 6 | 7 | module Jekyll 8 | 9 | class PugConverter < Converter 10 | 11 | def matches(ext) 12 | ext =~ /^\.pug$/i 13 | end 14 | 15 | def output_ext(ext) 16 | ".html" 17 | end 18 | 19 | def convert(content) 20 | begin 21 | o, e, s = Open3.capture3("pug", :stdin_data => content) 22 | puts(<<-eos 23 | Pug Error >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 24 | #{e} 25 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Pug Error 26 | eos 27 | ) if e.length > 0 28 | rescue Errno::ENOENT => e 29 | puts "** ERROR: Pug isn't installed or could not be found." 30 | puts "** ERROR: To install with NPM run: npm install pug -g" 31 | return nil 32 | end 33 | return o 34 | end 35 | 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 John Papandriopoulos. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | pug-jekyll-plugin (previously jade-jekyll-plugin) 2 | ================================================= 3 | 4 | Converter Plugin that brings Pug support to the [Jekyll blog-aware, static site generator](http://jekyllrb.com/). 5 | 6 | ## HOWTO 7 | 8 | 1. Install Pug with NPM. e.g. `$ npm install pug -g` 9 | 1. Place the `pug.rb` file into your Jekyll installation under `_plugins/` 10 | 1. All static pages and posts ending in the extension `.pug` are now processed through Pug automatically. 11 | 1. Layouts need special treatment, see below. 12 | 13 | ## Applying Pug to Layouts 14 | 15 | Unfortunately Jekyll doesn't yet allow plugins to pre-process layout files before further processing. To write your layouts in Pug, you therefore have to render them externally. Fortunately this only needs to be done frequently for a small period of time, during layout development. 16 | 17 | During layout development, we recommend: 18 | 19 | 1. Create a `_layouts/pug/` folder where you will place your "pre-rendered" Pug source. 20 | 2. Create a `Makefile` or shell script to execute the Pug compile-and-watch command: `pug -w -o ../ *.pug` 21 | 3. In another terminal, simultaneously run your Jekyll builds: e.g. `jekyll serve -w` 22 | 23 | ## License 24 | 25 | See [LICENSE](https://github.com/snappylabs/pug-jekyll-plugin/blob/master/LICENSE). 26 | 27 | --------------------------------------------------------------------------------