Minifies (almost) all HTML ids + classes, & CSS + JS selectors.
Turns this:
<a href="https://packagist.org/login/github" class="pull-right btn btn-primary btn-github">
<span class="icon-github" id="special_github"></span>Use Github
</a>
<style>.pull-right, .btn, .btn-primary, .btn-github, .icon-github {} #special_github{}</style>
<style>.btn{}</style>
<script>var githubButtons = document.getElementsByClassName('btn-github'); var specialGithub = document.getElementById('special_github');</script>
<script>githubIconButtons = $('.icon-github');</script>
Into this:
<a href="https://packagist.org/login/github" class="c e a d">
<span class="b" id="f"></span>Use Github
</a>
<style>.c, .e, .a, .d, .b {} #f{}</style>
<style>.e{}</style>
<script>var githubButtons = document.getElementsByClassName('d'); var specialGithub = document.getElementById('f');</script>
<script>githubIconButtons = $('.b');</script>
Put the .json files from planck-id/graphs into NoFlo
It can be installed from Packagist using Composer. Make sure your composer.json
contains:
{
"require": {
"aretecode/planck-id"
}
}
then, run:
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install
planck markup.html
planck markup.html --debug
planck markup.html > output.html
planck style.css map.json style Replace
Converting a file using an existing map, extracting more to add to the map, then replacing a style file:
planck style.css map.json style ExtractAndReplace
planck markup.html map.json markup Extract
echo -e '<section class="post-simple media-adjacent"></section><style>.post-simple{}</style>' | planck
echo -e '<section class="post-simple media-adjacent"></section><style>.post-simple{}</style>' | planck > output.html
- Planck: (Planck length, in principle, the shortest measurable length.) an instance of the shortest available valid class/id/selector.
- Original: the class/id/selector before it was turned into a Planck. (I'm open to changing this, feel free to suggest a new term.)
Using Flow Based Progamming it creates a map<original, planck>
according to the requirements, then passes the content into the series of components to achieve the desired outcome.
- Run in the browser by navigating to
planck-id/tests/Run.php
- Run via the command line by changing your directory to
planck-id/bin
and then runningbehat
- Run via the command line by going to
planck-id
and runningphpunit
(these tests use a snippet from thegrids website)