<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" version="2.0">
	<channel>
		
		<title>Emmet</title>
		<link>http://emmet.io</link>
		<description>Emmet — the essential toolkit for web-developers</description>
		<lastBuildDate>Mon, 23 Dec 2013 00:00:00 GMT</lastBuildDate>
		<language>en</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
		
			<item>
				<title>Beta version of Emmet v1.1</title>
				<link>http://emmet.io/blog/beta-v1-1/</link>
				<description>Beta version of Emmet v1.1 is available for Sublime Text users</description>
				<content:encoded>
					<![CDATA[<p>I’m happy to announce that first big update of Emmet is on its way! And it’s available for Sublime Text users as open beta.</p>
<h2 id="how-to-install-">How to install:</h2>
<ol>
<li>Remove current Emmet package from Package Control.</li>
<li>Quit Sublime Text editor.</li>
<li>Clone <a href="https://github.com/sergeche/emmet-sublime/">plugin repo</a> and switch to <code>v1.1</code> branch: <code>git checkout v1.1</code>. Or simply <a href="https://github.com/sergeche/emmet-sublime/archive/v1.1.zip">download</a> and unpack plugin into <code>Packages</code> folder of Sublime Text.</li>
<li>Start editor.</li>
</ol>
<h2 id="new-features-of-v1-1">New features of v1.1</h2>
<ul>
<li><strong>Support of <a href="http://caniuse.com">Can I Use</a> database.</strong> All CSS abbreviations are resolved against “Can I Use” database to provide vendor-prefixed properties. By default, Emmet uses <em>previous 2 versions</em> of <em>all</em> browsers, but you can tweak this behavior with <code>caniuse.era</code> and <code>caniuse.vendors</code> preferences. See <a href="https://github.com/emmetio/emmet/blob/umd/lib/assets/caniuse.js#L19">module header</a> for description.</li>
<li><strong>Full LESS and SCSS support.</strong> Actions like <a href="http://docs.emmet.io/actions/toggle-comment/">Toggle Comment</a>, <a href="http://docs.emmet.io/actions/update-image-size/">Update Image Size</a>, <a href="http://docs.emmet.io/actions/select-item/">Select Item</a> and so on are now working with LESS and SCSS (not SASS) syntaxes.</li>
<li><strong>Slim and Jade output syntaxes support.</strong> You can use the very same Emmet abbreviations to generate Slim and Jade content.</li>
<li><strong>Updated CSS Gradient generator</strong> supports W3C syntax specs, Can I Use database and multiple definitions (e.g. you can now expand <code>lg(red, black), lg(yellow, blue)</code>).</li>
<li><strong>Boolean attributes.</strong> You can now write boolean attributes (attributes with the same name and value) a bit shorter by placing dot after attribute name, like so: <code>inp[checked.]</code> → <code>&lt;input type=&quot;text&quot; checked=&quot;checked&quot; /&gt;</code> or <code>&lt;input type=&quot;text&quot; checked /&gt;</code>, depending on your output profile. Some attributes are globally defined as boolean (for example, <code>contenteditable</code>) so you don’t have to place dot after them. See <a href="https://github.com/emmetio/emmet/blob/umd/lib/assets/profile.js#L17">module header</a> for more info.</li>
<li><strong>Implied attributes.</strong> Some HTML tags are useless without their required attributes, for example, <code>&lt;img&gt;</code> tag without <code>src</code> attribute. Instead of writing <code>img[src=image.png]</code>, you can use shorter syntax: <code>img[image.png]</code>. <em>Every invalid attribute name will be treated as a value for empty attribute</em>. You can also wrap default attribute value in quotes, like so: <code>img[&#39;my image.png&#39;]</code>.</li>
<li><strong>Default attributes.</strong> Pretty much the same as <em>implied attributes</em> feature, but allows you to output specific attributes only if default value is provided. For example, <code>script</code> will produce <code>&lt;script&gt;&lt;/script&gt;</code>, but <code>script[jquery.js]</code> results to <code>&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;</code>. Default attributes are used in abbreviation definitions in <a href="https://github.com/emmetio/emmet/blob/umd/lib/snippets.json#L666">snippets.json</a>.</li>
<li><strong>New “Update Tag” action</strong> allows you to easily update any existing HTML tag with Emmet abbreviation. For example, if you have <code>&lt;div class=&quot;c1&quot;&gt;</code> element, place caret on it, run “Update Tag” action (Ctrl+Shift+U) and enter <code>.+c2[title=Hello]</code> to update tag to <code>&lt;div class=&quot;c1 c2&quot; title=&quot;Hello&quot;&gt;</code>. This action uses additional syntax to <em>overwrite</em>, <em>modify</em> or <em>remove</em> attribute. By default, all attributes in abbreviation will overwrite existing ones. Precede attribute or class name with <code>+</code> to <em>append</em> value, add <code>-</code> before attribute or class name to <em>remove</em> it. More docs and examples will be available later.</li>
<li><strong>“Match Tag Pair” was renamed to “Balance”</strong> and now works with CSS. You can quickly select property value, full property or selector content.</li>
<li><strong>Option to write CSS abbreviations on single line</strong>: in <code>syntaxProfiles.json</code>, set CSS’ output profile to <code>css_line</code>. <a href="http://docs.emmet.io/customization/syntax-profiles/">Read docs</a> about output profiles.</li>
<li><strong>New syntax to write RGBA colors.</strong> You can add <code>.N</code> after color value in CSS abbreviation to produce RGBA color: <code>c#dca.7</code> will produce <code>color: rgba(221, 204, 170, 0.7)</code>.</li>
</ul>
<h3 id="under-the-hood">Under the hood</h3>
<ul>
<li>Emmet is now fully Node.JS-compliant. You can use Emmet in your own packages (npm package will be available later).</li>
<li>Huge performance boost on many actions, especially in interactive actions (Wrap With Abbreviation, Expand as you type) on large documents.</li>
<li>Many other bugfixes and improvements.</li>
</ul>
<p>If you experience any issues with beta, please <a href="https://github.com/emmetio/emmet/issues">fill an issue</a>, but read <a href="https://github.com/sergeche/emmet-sublime/blob/v1.1/CONTRIBUTING.md">CONTRIBUTING</a> file first, especially about keyboard shortcuts.</p>
]]>
				</content:encoded>
				<pubDate>Mon, 23 Dec 2013 00:00:00 GMT</pubDate>
				<guid>http://emmet.io/blog/beta-v1-1/</guid>
				<comments>http://emmet.io/blog/beta-v1-1/#comments</comments>
			</item>
		
			<item>
				<title>TernJS plugin for Sublime Text</title>
				<link>http://emmet.io/blog/sublime-tern/</link>
				<description>Intelligent JavaScript editing in Sublime Text</description>
				<content:encoded>
					<![CDATA[<p>As <a href="/credits/">Credits</a> page says, Emmet is going to be a brand name for tools for web-developers. And today I want you to present a new tool: <a href="https://github.com/emmetio/sublime-tern"><em>Sublime Tern</em></a>.</p>
<h2 id="what-is-ternjs-">What is TernJS?</h2>
<p><a href="http://ternjs.net">TernJS</a> is a JavaScript inferring engine written by <a href="http://marijnhaverbeke.nl">Marijn Haverbeke</a>. Basically, it can trace context object in JavaScript and give you some info about it: its type, available properties, definition and so on. It can provide you with great advantages while editing JavaScript code: correct code completions, basic refactoring (like variable renaming) and location of object definition. Also, it’s written in JavaScript and it can be extended.</p>
<p>Usually, features like valid code completions and variable renaming are available in big IDEs like Eclipse and WebStorm, but now they are coming into your favourite editor with <em>Sublime Tern</em> plugin!</p>
<h2 id="how-to-install">How to install</h2>
<p>Sublime Tern can be installed as any other plugin with <a href="http://wbond.net/sublime_packages/package_control">Package Control</a>:</p>
<ol>
<li>In ST editor, call “Install Package” command from Command Palette.</li>
<li>Find “TernJS” in plugins list and hit Enter to install it.</li>
</ol>
<p>When installed, Sublime Tern will automatically download PyV8 binary required to run this plugin. If you experience issues with PyV8 loader, you can <a href="https://github.com/emmetio/pyv8-binaries#readme">install it manually</a>.</p>
<p><em>Warning</em>: if you have <a href="https://github.com/sergeche/emmet-sublime">Emmet</a> plugin installed (and you really should :-) and using Sublime Text 2, you have to make sure you have the latest PyV8 binary. It must be automatically updated within 24 hours (you need to restart ST2 editor), but you can forcibly update it:</p>
<ol>
<li>Quit ST2 editor</li>
<li>Completely remove <code>PyV8</code> package (remove this folder from ST2’s <code>Packages</code> folder)</li>
<li>Start ST2 editor. Latest PyV8 should be downloaded and installed automatically.</li>
</ol>
<p>With old PyV8 binary, you’ll experience a lot of crashes.</p>
<h2 id="how-to-use-it">How to use it</h2>
<p>You should keep in mind a few things before using <em>Sublime Tern</em> plugin.</p>
<h3 id="projects-first">Projects first</h3>
<p>To get most of Sublime Tern plugin, you should edit your files inside <a href="http://www.sublimetext.com/docs/2/projects.html">Project</a>. When you open a JavaScript file in ST editor, plugin automatically detects project for it and loads <em>all JS files</em> from it for code completion (read “Configuring Project” section below to alter this behaviour).</p>
<p>Otherwise, if you’re editing file outside project, code completion and other actions will work for this file only.</p>
<h3 id="slow-start">Slow start</h3>
<p>When you open JS file from project for the first time, you may experience editor slow down, especially for large projects. It’s because Sublime Tern plugin loads and analyses JS files from your project so you have to wait a bit.</p>
<p>Also, you may receive a “slow plugin” warning in Sublime Text 2: you can either skip it or <a href="http://www.sublimetext.com/forum/viewtopic.php?f=3&amp;t=5527">disable this warning</a>.</p>
<h3 id="reload-ternjs">Reload TernJS</h3>
<p>If you create or update files outside ST editor, or you believe that TernJS doesn’t contains most recent version of your project files, you can force Sublime Tern plugin to update it’s state. Simply call <strong>“TernJS: Reload”</strong> action from Command Palette to re-initialize TernJS servers.</p>
<h2 id="available-actions">Available actions</h2>
<ul>
<li><strong>Code Completions</strong>. Press <code>Ctrl+Space</code> to show completions for current context. They can also appear automatically, depending on your ST preferences.</li>
<li><strong>Jump to definition</strong>: goes to file and position where context variable/function in defined.</li>
<li><strong>Rename variable</strong>: marks context object occurrences and allows you to rename them. Press <code>Enter</code> or <code>Esc</code> to commit changes.</li>
<li><strong>Next/Previous occurrence</strong>: selects next/previous occurrence of context variable/method.</li>
<li><strong>Reload</strong>: reloads all JS files from project. Use this action if your files were changed outside ST editor.</li>
</ul>
<p>All actions are available in ST’s Command Palette and have no default keyboard shortcuts. You can <a href="http://docs.sublimetext.info/en/latest/customization/key_bindings.html">define them by your own</a>, valid command names are: </p>
<ul>
<li><code>ternjs_jump_to_definition</code></li>
<li><code>ternjs_rename_variable</code></li>
<li><code>ternjs_next_occurance</code></li>
<li><code>ternjs_previous_occurance</code></li>
<li><code>ternjs_reload</code></li>
</ul>
<h2 id="configuring-project">Configuring project</h2>
<p>By default, Sublime Tern loads all JS from your project folder and provides completions for standard ECMA5 objects like <code>String</code>, <code>Array</code> etc. If you want to load specific files only or have completions for browser objects or jQuery, you need to <em>configure project</em> first.</p>
<p>In Sublime Text, projects are defined by simple JSON file with <code>.sublime-project</code> extension. You can add <code>ternjs</code> section into <code>.sublime-project</code> file to set-up TernJS for your project. </p>
<p>The example project file with TernJS config may look like this:</p>
<pre><code class="language-json"><span class="undefined">{
    …

    "ternjs": {
        "exclude": ["wordpress/**", "node_modules/**"],
        "libs": ["browser", "jquery"],
        "plugins": {
            "requirejs": {
                "baseURL": "./js"
            }
        }

    }
}</span></code></pre>
<p>Available options:</p>
<ul>
<li><code>include</code> and <code>exclude</code> are glob patterns for files that should be analysed by TernJS. By default, plugin loads all JS files from project folder (equals to <code>&quot;include&quot;: [&quot;**/*.js&quot;]</code>). With these options, you can narrow down file list that should be analysed by TernJS which speeds-up overall plugin performance and gives you less noise for completions.</li>
<li><code>libs</code>: array of static type descriptions. These are JSON files with types structure that can be cheaply loaded by TernJS for code completions. See <a href="https://github.com/emmetio/sublime-tern/tree/master/ternjs/defs">list of predefined descriptions</a>. You can also specify a path (either relative to current project or absolute) to your custom JSON files.</li>
<li><code>plugins</code>: set of plugins for TernJS instance. Plugins can extend inferring engine and provide completions for some complex situations, for example, to resolve Require.JS or Node.JS modules. See <a href="https://github.com/emmetio/sublime-tern/tree/master/ternjs/plugin">list of redefined plugins</a>. For custom plugins, add <code>pluginPath</code> property into your plugin config with path to plugin folder.</li>
</ul>
<h2 id="known-issues">Known issues</h2>
<p>Sometimes, especially on complex libraries like jQuery or Underscore.js, you may experience heavy slowdowns or even crashes. Check ST console for possible errors. If you see something like this:</p>
<pre><code><span class="avrasm"><span class="label">RangeError:</span> Maximum <span class="keyword">call</span> stack size exceeded ( js/infer<span class="preprocessor">.js</span> @ <span class="number">43</span> : <span class="number">21</span> )</span></code></pre><p>…you should:</p>
<ol>
<li>Report to <a href="https://github.com/marijnh/tern">main TernJS repo</a> (<a href="https://github.com/marijnh/tern/issues/16">like so</a>).</li>
<li>Exclude this file(s) from project config with <code>include</code> and <code>exclude</code> preferences (see “Configuring Project” section above).</li>
</ol>
<hr>
<p>Please note that Sublime Tern (as TernJS itself) is in early beta stage and may not work properly or even crash your editor. If you experience issues with code completions or crashes, you should report directly to <a href="https://github.com/marijnh/tern/issues">main TernJS repo</a> or <a href="https://github.com/emmetio/sublime-tern/issues">Sublime Tern plugin repo</a>.</p>
]]>
				</content:encoded>
				<pubDate>Wed, 03 Apr 2013 00:00:00 GMT</pubDate>
				<guid>http://emmet.io/blog/sublime-tern/</guid>
				<comments>http://emmet.io/blog/sublime-tern/#comments</comments>
			</item>
		
			<item>
				<title>Sublime Text 3 support</title>
				<link>http://emmet.io/blog/sublime-text-3/</link>
				<description>Emmet now supports Sublime Text 3 beta! </description>
				<content:encoded>
					<![CDATA[<p>Emmet now supports <a href="http://www.sublimetext.com/3">Sublime Text 3</a> beta! </p>
<p>How to install:</p>
<p>The preferred way to install Emmet is to use <a href="http://wbond.net/sublime_packages/package_control">Package Control</a>: </p>
<ol>
<li>Open Command Palette in Sublime Text</li>
<li>Pick “Install Package” command</li>
<li>Find and install “Emmet” plugin</li>
</ol>
<p>Or install it manually:</p>
<ol>
<li>Quit ST3.</li>
<li>Clone <a href="https://github.com/sergeche/emmet-sublime/">plugin repo</a> or <a href="https://github.com/sergeche/emmet-sublime/archive/master.zip">download</a> and unpack plugin into <code>Packages</code> folder of ST3.</li>
<li>Start editor.</li>
</ol>
<p>The plugin will automatically download and install PyV8 binary for OS. The PyV8 is required to run Emmet (written in JavaScript) as Sublime Text plugin (should be written in Python). If it doesn’t happen or you experience issues, try to <a href="https://github.com/emmetio/pyv8-binaries">install it manually</a>.</p>
]]>
				</content:encoded>
				<pubDate>Mon, 25 Feb 2013 00:00:00 GMT</pubDate>
				<guid>http://emmet.io/blog/sublime-text-3/</guid>
				<comments>http://emmet.io/blog/sublime-text-3/#comments</comments>
			</item>
		
			<item>
				<title>Create professional websites with DocPad</title>
				<link>http://emmet.io/blog/docpad/</link>
				<description>Continue to introduce my open-source tools, created during Emmet development. Last time it was CodeMirror Movie and this time I’ll introduce you the process of creating a documentation web-site with DocPad.</description>
				<content:encoded>
					<![CDATA[<p>Continue to introduce my open-source tools, created during Emmet development. Last time it was <a href="/blog/codemirror-movie/">CodeMirror Movie</a> and this time I’ll introduce you the process of creating a <a href="http://docs.emmet.io">documentation web-site</a> with DocPad.</p>
<hr>
<h2 id="tl-dr-tools-to-make-a-professional-high-performance-website-with-docpad">tl;dr - Tools to make a professional high-performance website with DocPad</h2>
<ul>
<li>Use <a href="https://github.com/sergeche/docpad-plugin-menu">docpad-plugin-menu</a> for automatic menu generation for your website.</li>
<li>Use <a href="https://github.com/sergeche/grunt-frontend">grunt-frontend</a> and <a href="https://github.com/sergeche/docpad-plugin-frontend">docpad-plugin-frontend</a> to minify CSS and JS files and cache them properly.</li>
<li>Create a special debugging environment for <code>docpad-plugin-frontend</code> to use source CSS and JS files instead of minified ones.</li>
<li>Set up a web hooks on GitHub and <a href="http://weblog.bocoup.com/introducing-gith-github-webhooks-for-node/">Gith</a> on your server to automatically deploy website after each commit.</li>
<li>Setting up nginx to properly cache static files and save CPU resources.</li>
</ul>
<hr>
<p><a href="https://docpad.org">DocPad</a> is a static website generator written in CoffeeScript. Unlike websites created with regular CMS as Django, Drupal and Wordpress, static websites, being a set of simple pre-generated HTML files, consume very little of server resources. That’s why you need web server like Apache or nginx only to serve such websites</p>
<p>It was an ideal solution for <a href="http://docs.emmet.io">Emmet documentation</a> (<a href="https://github.com/emmetio/emmet-docs">source code</a>) website because it not only provides a simplified development process, but allows me to reduce my hosting costs greatly.</p>
<p>But DocPad, like many other generators, has a several disadvantages, which do not allow to create a truly professional and fast websites. So I decided to fix them by writing a few plug-ins:</p>
<ul>
<li><a href="https://github.com/sergeche/docpad-plugin-menu">docpad-plugin-menu</a> - Automatic web-site menu generation.</li>
<li><a href="https://github.com/sergeche/grunt-frontend">grunt-frontend</a> - “smart” front-end assets builder.</li>
<li><a href="https://github.com/sergeche/docpad-plugin-frontend">docpad-plugin-frontend</a> - outputs CSS and JS files, builded  with <code>grunt-frontend</code>, with proper correct caching, and provides assets management across templates.</li>
</ul>
<p>If you are not familiar with DocPad, I recommend you to see and read <a href="https://docpad.org/docs/intro">Introduction to DocPad</a> for better understanding what I’m going to talk about.</p>
<h2 id="menu-generation">Menu generation</h2>
<p>The <a href="https://github.com/sergeche/docpad-plugin-menu">docpad-plugin-menu</a> can generate a structured menu for all documents of your website (that is, for all the files in <code>src/documents</code> folder). This plugin adds a <code>generateMenu(url)</code> method to the <code>templateData</code> object: the context object of all templates rendering. This method takes the URL of the page for which the menu should be generated and returns a menu object, which can be rendered, for example, using <a href="https://github.com/docpad/docpad-plugin-partials/">partials</a>.</p>
<p>For further information about the plugin and usage examples visit <a href="https://github.com/sergeche/docpad-plugin-menu#readme">project’s main page</a>.</p>
<h2 id="building-front-end-assets">Building front-end assets</h2>
<p>For convenience, I usually split-up my CSS and JS into several files, which are concatenated and minified for production website. It’s a common practice for high-performance websites development. For building, I use <a href="http://gruntjs.com">Grunt.js</a> which seems to have all the required plug-ins for concatenation and minification.</p>
<p>But I didn’t find anything suitable there. The problem is that minified file’s <em>modification date</em> is very important for me because I’m going to use it in file’s URL to effectively reset file cache. Therefore, the destination file should be updated only if any of the source files did.</p>
<p>To solve this problem I wrote the <a href="https://github.com/sergeche/grunt-frontend">grunt-frontend</a> plugin. Here’s how it works. During concatenation and minification of source files, it writes files list and their md5 hashes into a special <code>.build-catalog.json</code> file. On the next build plugin compares saved file list state with the original one and if nothing changed, it doesn‘t update the destination file.</p>
<p>This not only reduces the build time, but also allows you to save important data of destination file such as modification date and md5 hash. This data is stored in <code>.build-catalog.json</code> (it’s better to keep this file out of version control) and can be read by third-party apps.</p>
<p>The <code>grunt-frontend</code> plugin uses Yandex’s <a href="https://github.com/css/csso">CSSO</a> with automatic <code>@import</code>s inlining and <a href="https://github.com/mishoo/UglifyJS">UglifyJS</a> for minification.</p>
<p>For more info visit plugin’s <a href="https://github.com/sergeche/grunt-frontend">project page</a>.</p>
<h2 id="assets-management">Assets management</h2>
<p>Very often there is a need to manage collections of CSS and JS files on different pages of your website. For example, you want all pages to use a <code>set1</code> files collection; all pages of <code>/about/</code> section must additionally use <code>set2</code> and <code>set3</code> collections, but for the  <code>/about/contacts/</code> page you want to use <code>set4</code> instead of <code>set2</code> (i.e. <code>set1</code>, <code>set4</code>, <code>set3</code>, in exactly that order). Additionally, each resource URL must contain file’s last modification date for effective cache resetting.</p>
<p>I wrote a <a href="https://github.com/sergeche/docpad-plugin-frontend">docpad-plugin-frontend</a> for assets management. It adds <code>assets(prefix)</code> method to <code>templateData</code>, which allows you to get a sorted list of assets from the current document and its templates chain. If the project root folder contains <code>.build-catalog.json</code>, the plugin reads it and returns a list of resource URLs prefixed with a modification date.</p>
<p>For example, the problem with resource management described above can be solved as follows. In meta-data of <code>default.html.eco</code> template specify the primary files collection:</p>
<pre><code><span class="haskell"><span class="comment">---</span>
<span class="title">js</span>: <span class="string">"/js/fileA.js"</span>
<span class="comment">---</span></span></code></pre><p>For <code>about.html.eco</code> template, which is inherited from the default template and used by documents of <code>/about/*</code> section, define the following:</p>
<pre><code><span class="haskell"><span class="comment">---</span>
<span class="title">layout</span>: default
<span class="title">js2</span>: [<span class="string">"/js/fileB.js"</span>, <span class="string">"/js/fileC.js"</span>]
<span class="title">js3</span>: [<span class="string">"/js/fileD.js"</span>, <span class="string">"/js/fileE.js"</span>]
<span class="comment">---</span></span></code></pre><p>In <code>/about/contacts/index.html</code> document, override <code>js2</code> collection:</p>
<pre><code><span class="haskell"><span class="comment">---</span>
<span class="title">layout</span>: about
<span class="title">js2</span>: <span class="string">"/js/contacts.js"</span>
<span class="comment">---</span></span></code></pre><p>Now, during <code>/about/contacts/index.html</code> document rendering, the <code>assets(&#39;js&#39;)</code> method call will return the following collection of files:</p>
<ul>
<li><code>/js/fileA.js</code></li>
<li><code>/js/contacts.js</code></li>
<li><code>/js/fileD.js</code></li>
<li><code>/js/fileE.js</code></li>
</ul>
<p>As you can see, plugin usage is pretty simple: come up with a prefix for resource category and use numeric suffixes to define collections of files. Then, call the <code>assets()</code> method with category prefix inside templates to get sorted list of files. Collections with the same name are overridden.</p>
<p>For more info about how to use plugin visit <a href="https://github.com/sergeche/docpad-plugin-frontend#readme">project’s home page</a>.</p>
<h2 id="debug-mode">Debug Mode</h2>
<p>Very often users of your website may send you error reports: a JavaScript or CSS layout problems in specific web-browser. But all your CSS and JS files are minified and it’s pretty hard to track the problem source.</p>
<p>You can track issues using <a href="http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/">Source Maps</a> in the future, but currently not every minifier and web-browsers supports them.</p>
<p>The <code>docpad-plugin-frontend</code> has a special debugging mode. Since the structure of minified files is stored in the JSON catalog, we can easily extract source files and use them instead on minified ones when necessary.</p>
<p>To do this, you can create a separate DocPad <em>environment</em> with <code>frontendDebug: true</code> option. When <code>frontendDebug</code> option is set to <code>true</code>, the <code>assets()</code> method will try to return list of corresponding source files found in <code>.build-catalog.json</code>.Here’s example <code>docpad.coffee</code> config with debug environment:</p>
<pre><code><span class="r">module.exports = {
    <span class="keyword">...</span>
    environments:
        debug:
            frontendDebug: true
}</span></code></pre><p>Now if you run <code>DocPad</code> with <code>debug</code> environment, you will get a HTML-page with the original CSS and JS files so you will be able to  spot errors:</p>
<pre><code><span class="nginx"><span class="title">docpad</span> run --env​​=<span class="built_in">debug</span></span></code></pre><h2 id="automatically-deploy-from-github">Automatically deploy from GitHub</h2>
<p>I’ve set-up my server so it can automatically re-generate a full website after each commit into <code>master</code> branch of <a href="https://github.com/emmetio/emmet-docs">project’s GitHub repo</a>.</p>
<p>On GitHub I’ve set up a custom web hook and Gith on my server.</p>
<p><a href="http://weblog.bocoup.com/introducing-gith-github-webhooks-for-node/">Gith</a> is a convenient Node.JS web server which is able to receive and filter payload coming from GitHub web hooks. My Gith server script that deploys website looks like this:</p>
<pre><code><span class="haskell"><span class="title">var</span> childProc = require('child_process');
<span class="title">var</span> path = require('path');

<span class="title">var</span> gith = require('gith').create(<span class="number">3000</span>);

<span class="title">gith</span>({
    // <span class="type">Listen</span> to the hooks from <span class="string">"master"</span> branch only
    branch:<span class="string"> 'master'</span>
}).on('all', function(payload) {
    console.log('<span class="type">Run</span> deply script on', new <span class="type">Date</span>());

    // <span class="type">Run</span> deploy script
    var deploy = childProc.spawn('sh', ['/web/deploy.sh']);

    deploy.stdout.on('<span class="typedef"><span class="keyword">data</span>', function<span class="container">(<span class="title">data</span>)</span> <span class="container">{
        <span class="title">var</span> <span class="title">message</span> = <span class="title">data</span>.<span class="title">toString</span>('<span class="title">utf8'</span>);

        <span class="title">if</span> (~<span class="title">message</span>.<span class="title">indexOf</span>('<span class="title">subscribe'</span>)) {
            // <span class="type">Docpad</span> <span class="title">may</span> <span class="title">ask</span> <span class="title">for</span> <span class="title">newsletter</span> <span class="title">subscription</span>, <span class="title">say</span> "<span class="title">no</span>"
            <span class="title">deploy</span>.<span class="title">stdin</span>.<span class="title">write</span>('<span class="title">n'</span>);
        }</span> else if <span class="container">(~<span class="title">message</span>.<span class="title">toLowerCase</span>()</span>.indexOf<span class="container">('<span class="title">privacy'</span>)</span>) <span class="container">{
            // <span class="type">Docpad</span> <span class="title">may</span> <span class="title">ask</span> <span class="title">about</span> <span class="title">privacy</span> <span class="title">policy</span>, <span class="title">agree</span> <span class="title">with</span> <span class="title">it</span>
            <span class="title">deploy</span>.<span class="title">stdin</span>.<span class="title">write</span>('<span class="title">y'</span>);
        }</span></span>
    });

    deploy.stderr.on('<span class="typedef"><span class="keyword">data</span>', function<span class="container">(<span class="title">data</span>)</span> <span class="container">{
        <span class="title">console</span>.<span class="title">log</span>('<span class="type">Error</span>: ', <span class="title">data</span>.<span class="title">toString</span>('<span class="title">utf8'</span>));
    }</span>);</span>

    deploy.on('exit', function(code) {
        console.log('<span class="type">Deploy</span> complete with exit code<span class="string"> ' + code);
    });
});</span></code></pre><p>The <code>deploy.sh</code> script looks like this:</p>
<pre><code><span class="haskell">#! /usr/bin/env bash
<span class="title">git</span> pull
<span class="title">git</span> submodule foreach<span class="string"> 'git checkout master &amp;&amp; git pull origin master'</span>
<span class="title">npm</span> install
<span class="title">grunt</span>
<span class="title">docpad</span> generate
<span class="title">find</span> ./out -<span class="typedef"><span class="keyword">type</span> f \<span class="container">( -<span class="title">name</span> '*.<span class="title">html'</span> -<span class="title">o</span> -<span class="title">name</span> '*.<span class="title">css'</span> -<span class="title">o</span> -<span class="title">name</span> '*.<span class="title">js'</span> \)</span>  -exec sh -c "gzip -7 -f &lt; <span class="container">{}</span> > <span class="container">{}</span>.gz" \;</span></span></code></pre><h2 id="configuring-nginx">Configuring nginx</h2>
<p>I use <a href="http://nginx.org">nginx</a> as a web server, which is highly optimized for static files serving. In nginx website config, we need to specify the following:</p>
<ul>
<li>Rewrite paths for static files: remove the timestamp prefix from URL and send the correct caching headers.</li>
<li>Serve static files gzipped to reduce the amount of transferred data.</li>
</ul>
<p>If you take a closer look at the <code>deploy.sh</code> script, you’ll see that in the last step we created a gzipped versions of HTML, CSS and JS files. There is a special nginx <a href="http://wiki.nginx.org/HttpGzipStaticModule">HttpGzipStaticModule</a> which can serve a precompressed <code>.gz</code> file (if it exists at the same location) instead of compressing it for each request. This trick allows us to save CPU resources. To use this module, you must add it to nginx at compile time:</p>
<pre><code><span class="ruby">.<span class="regexp">/configure --with-http_gzip_static_module</span></code></pre><p>My nginx config looks like this:</p>
<pre><code><span class="nginx"><span class="title">server</span> {
    <span class="title">server_name</span>  your-server.com;
    <span class="title">root</span>         /path/to/web-site/out;

    <span class="title">index</span>  index.html index.htm;

    <span class="comment"># trim modification date from resource URL</span>
    <span class="title">location</span> <span class="regexp">~* ^/\d+/(css|js)/</span> {
        <span class="title">rewrite</span><span class="regexp"> ^/(\d+)/(.*)$</span> /<span class="variable">$2</span>;
    }

    <span class="comment"># cache front-end assets</span>
    <span class="title">location</span> <span class="regexp">~* \.(ico|css|js|gif|jpe?g|png)$</span> {
        <span class="title">expires</span> max;
        <span class="title">access_log</span> <span class="built_in">off</span>;
        <span class="title">add_header</span> Pragma public;
        <span class="title">add_header</span> Cache-Control <span class="string">"public"</span>;
    }

    <span class="comment"># enable precompressed .gz files serving</span>
    <span class="title">gzip_static</span> <span class="built_in">on</span>;
}</span></code></pre>]]>
				</content:encoded>
				<pubDate>Sun, 24 Feb 2013 00:00:00 GMT</pubDate>
				<guid>http://emmet.io/blog/docpad/</guid>
				<comments>http://emmet.io/blog/docpad/#comments</comments>
			</item>
		
			<item>
				<title>CodeMirror Movie</title>
				<link>http://emmet.io/blog/codemirror-movie/</link>
				<description>During Emmet project development, I’ve created a few open-source tools and I’d like to introduce them to you. The first thing I would like to introduce to you is a CodeMirror Movie. You can see it in many pages of documentation web-site: it is the plugin that shows interactive code demos.</description>
				<content:encoded>
					<![CDATA[<p>During Emmet project development, I’ve created a few open-source tools and I’d like to introduce them to you.</p>
<p>The first thing I would like to introduce to you is a <a href="https://github.com/sergeche/codemirror-movie">CodeMirror Movie</a>. You can see it in many pages of <a href="http://docs.emmet.io">documentation web-site</a>: it is the plugin that shows interactive code demos.</p>
<p>When I started working on the documentation, I wanted to demonstrate all Emmet features in a more descriptive manner. Reading long texts describing how actions work is always boring and tedious, it is much more better to see “live” how they work.</p>
<p>Usually, developers record videos with demos, but it’s not my case for many reasons:</p>
<ul>
<li>Recording a <em>high-quality</em> video takes too much time. For example, it took me about four hours to create a <a href="https://vimeo.com/7405114">six-minute video about Zen Coding v0.5</a>.</li>
<li>The video is hard to update. For example, if someone finds errors  or users will not understand how action works, it’s likely required to create a new movie.</li>
<li>Because Emmet is written in pure JavaScript (and hence works in web browsers), I wanted users not only to <em>see</em> how things work, but to <em>try</em> them in action right in documentation pages.</li>
</ul>
<p>To solve these and other problems, I’ve created <a href="https://github.com/sergeche/codemirror-movie">CodeMirror Movie</a> plugin. It’s pretty easy to use it: you create a small <em>script</em>, which defines what should be done by plugin. For example, ”write the text, wait a moment, and then show the tooltip on current caret position”.</p>
<p>As you can guess from the plugin name, it is based on amazing <a href="http://codemirror.net">CodeMirror</a> editor, which means that you can create demos for any programming language supported by this editor.</p>
<h2 id="creating-a-movie">Creating a movie</h2>
<p>Usually, to create CodeMirror editor instance you create a <code>&lt;textarea&gt;</code> element with the initial contents of the editor and call the following JS code:</p>
<pre><code class="language-javascript"><span class="javascript"><span class="keyword">var</span> myCodeMirror = CodeMirror.fromTextArea(myTextArea);</span></code></pre>
<p>To create a movie, you need to create a <code>&lt;textarea&gt;</code> too with initial contents and <em>movie scenario</em>, separated by <code>@@@</code> line:</p>
<pre><code class="language-html">&lt;textarea id=&quot;code&quot;&gt;
&amp;lt;div class=&quot;content&quot;&amp;gt;
    |
&amp;lt;/div&amp;gt;
@@@
type: Hello world
wait: 1000
tooltip: Sample tooltip
&lt;/textarea&gt;</code></pre>
<p>To initialize the movie, you should call <code>CodeMirror.movie()</code> method and pass <code>&lt;textarea&gt;</code> ID (or element reference) as the first argument:</p>
<pre><code class="language-javascript"><span class="javascript"><span class="keyword">var</span> movie = CodeMirror.movie(<span class="string">'code'</span>);

<span class="comment">// start playback</span>
movie.play();</span></code></pre>
<h2 id="movie-scenario">Movie scenario</h2>
<p>As noted above, to create a movie you need to write its <em>scenario</em>.</p>
<p>A scenario is a <em>list</em> of commands to be executed. Each command is written on a separate line in the <code>name: value</code> form. The value can be written as JS object with command options, but each command has a pretty good default values so you can pass just a string value of the most important option. For example, the following scenario tells CodeMirror Movie to type “Hello world”, then to wait for a second and show “CodeMirror rocks!” tooltip:</p>
<pre><code><span class="http"><span class="attribute">type</span>: <span class="string">Hello world</span>
<span class="attribute">wait</span>: <span class="string">1000</span>
<span class="attribute">tooltip</span>: <span class="string">CodeMirror rocks!</span></span></code></pre><p>For more info about all available scenario commands and examples visit <a href="https://github.com/sergeche/codemirror-movie">plugin page</a>. You can use this plugin whatever you like (MIT license). It looks especially great in JS-based presentation engines like <a href="http://bartaz.github.com/impress.js/">impress.js</a> or <a href="http://lab.hakim.se/reveal-js/">reveal.js</a>. I hope you’ll enjoy it!</p>
]]>
				</content:encoded>
				<pubDate>Sun, 24 Feb 2013 00:00:00 GMT</pubDate>
				<guid>http://emmet.io/blog/codemirror-movie/</guid>
				<comments>http://emmet.io/blog/codemirror-movie/#comments</comments>
			</item>
		
			<item>
				<title>Emmet v1.0 is out</title>
				<link>http://emmet.io/blog/emmet-v1/</link>
				<description>I’m happy to announce that after more than six months of development the Emmet v1.0 is officially released. Maybe you’ve already used Emmet for months, but only now, after numerous bug fixes and improvements, I can say that it works as expected.</description>
				<content:encoded>
					<![CDATA[<p>I’m happy to announce that after more than six months of development the <a href="http://emmet.io">Emmet</a> (formerly Zen Coding) v1.0 is officially released. Maybe you’ve already been using Emmet for months, but only now, after numerous bug fixes and improvements, I can say that it works as expected.</p>
<p>What has been changed since the Zen Coding?</p>
<p>At first, the project name has been changed. “Emmet” is gonna be brand name for new tools and not all of them will be related to “coding”.</p>
<p>Secondly, the project has received <a href="http://emmet.io">official web-site</a> and <a href="http://docs.emmet.io">extensive documentation</a> about all available features.</p>
<p>Thirdly, improved CSS support: you can write property values <a href="http://docs.emmet.io/css-abbreviations/">directly in the abbreviation</a>, <a href="http://docs.emmet.io/css-abbreviations/gradients/">create gradients</a> and <a href="http://docs.emmet.io/css-abbreviations/vendor-prefixes/">vendor-prefixed properties</a>. Also, user’s reports about lengthy and hard-to-remember CSS abbreviations were considered and now Emmet utilizes <a href="http://docs.emmet.io/css-abbreviations/fuzzy-search/">fuzzy search</a> for CSS abbreviations.</p>
<p>Here is a list of other significant changes:</p>
<ul>
<li>The project’s code base was rewritten from scratch. It has become more modular and extensible.</li>
<li>The Python version was discarded. I found it quite difficult to maintain two versions of the core. Instead, Emmet uses bridges for <a href="https://github.com/sergeche/emmet-sublime/tree/master/emmet">Python</a>, <a href="https://github.com/emmetio/emmet-objc">Objective-C</a> and <a href="https://github.com/emmetio/emmet-eclipse">Java</a>, which allow to fix bugs and add new features for all platforms very quickly.</li>
<li>Improved <a href="http://docs.emmet.io/abbreviations/implicit-names/">implicit tag name resolver</a>. Previously, if you tried to expand abbreviations like <code>.item</code>, you could receive either <code>&lt;div class=&quot;item&quot;&gt;</code>, or <code>&lt;span class=&quot;item&quot;&gt;</code>, depending on the parent tag. The resolver is now looking at a parent tag’s name and can produce, for example, <code>&lt;li&gt;</code>, <code>&lt;td&gt;</code>, <code>&lt;option&gt;</code>.</li>
<li><a href="http://docs.emmet.io/customization/">Extensions support</a>. Now, to add a new abbreviation or customize the output format, there’s no need to dig into the plugin code, you just have to create simple JSON files in a special folder.</li>
<li><a href="http://docs.emmet.io/abbreviations/lorem-ipsum/">“Lorem Ipsum” generator</a>. Previously, to get a “dummy” text for the web-site, you had to use third-party services to generate “dummy” text and then format it. Now you can get it right in your text editor, and you can control the number of generated words by simply appending a number after the abbreviation. Moreover, the generator uses all Emmet abbreviations features, allowing you to add attributes to the generated elements and control the number of created blocks.</li>
<li><a href="http://docs.emmet.io/abbreviations/syntax/#climb-up-">New <code>^</code> operator</a>. Despite the fact that there is a more powerful <a href="http://docs.emmet.io/abbreviations/syntax/#grouping-">grouping operator</a>, often it takes too much time to update abbreviation with braces to output the next element one level up. Now it is sufficient to write the <code>^</code> operator to output next element one level up the tree.</li>
</ul>
<h2 id="what-s-new-since-beta-release">What’s new since beta release</h2>
<ul>
<li>You can <a href="http://docs.emmet.io/abbreviations/syntax/#changing-numbering-base-and-direction">control numbering base and direction</a> with <code>@</code> modifier. For example, <code>ul&gt;li.item$@-*5</code> will number items in descending order (e.g. from 5 to 1).</li>
<li>To automatically align expanded CSS properties with vendor prefixes, set <a href="http://docs.emmet.io/customization/preferences/"><code>css.alignVendor</code> preference</a> to <code>true</code>.</li>
<li>In most editors, “Update Image Size” will also work for remote images (like <code>http://example.com/image.png</code>).</li>
<li><a href="http://docs.emmet.io/css-abbreviations/fuzzy-search/">Fuzzy search</a> for CSS abbreviations.</li>
<li><a href="http://docs.emmet.io/css-abbreviations/#color-values">Embedded color values</a> in CSS abbreviations.</li>
<li><a href="https://github.com/emmetio/Emmet.sugar#readme">Espresso</a>, <a href="https://github.com/emmetio/Emmet.codaplugin#readme">Coda</a> and <a href="https://github.com/emmetio/Emmet.tmbundle#readme">TextMate</a> plugins are automatically updated via Sparkle.</li>
<li><a href="https://github.com/emmetio/npp">Notepad++ plugin</a> now uses Python Script base (thanks to Dave Brotherstone) which is more stable and feature-rich than previous one. Also, it’s available in Plugin Manager.</li>
</ul>
<hr>
<p>The project source code and plug-ins are available in <a href="https://github.com/emmetio">special repository</a>. If you find any errors or have suggestions for improvement, please <a href="https://github.com/emmetio/emmet/issues">let me know</a>.</p>
]]>
				</content:encoded>
				<pubDate>Sun, 24 Feb 2013 00:00:00 GMT</pubDate>
				<guid>http://emmet.io/blog/emmet-v1/</guid>
				<comments>http://emmet.io/blog/emmet-v1/#comments</comments>
			</item>
		
	</channel>
</rss>