Skip to content

Instantly share code, notes, and snippets.

@necolas
necolas / hogan-3.0.0.min.js
Last active December 25, 2015 23:59
Hogan.js nested template inheritance test.
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var Hogan={};(function(e,t){function n(e,t,n){var r,i;return t&&typeof t=="object"&&(t[e]!=null?r=t[e]:n&&t.get&&typeof t.get=="function"&&(r=t.get(e))),r}function r(e,t,n,r,i,s){function o(){}function u(){}o.prototype=e,u.prototype=e.subs;var a,f=new o;f.subs=new u,f.subsText={},f.ib(),r=r||{},f.stackSubs=r;for(a in t)r[a]||(r[a]=t[a]),f.subsText[a]=s;for(a in r)f.subs[a]=r[a];i=i||{},f.stackPartials=i;for(a in n)i[a]||(i[a]=n[a]);for(a in i)f.partials[a]=i[a];return f}function l(e){return String(e===null||e===undefined?"":e)}function c(e){return e=l(e),f.test(e)?e.replace(i,"&").replace(s,"<").replace(o,">").replace(u,"'").replace(a,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.ib()},e.Template.prototype={r:function(e,t,n){return""},v:c,t:l,render:function(t,n,r){retu
@necolas
necolas / structure
Created December 18, 2013 01:02
Wintersmith site structure, using Component(1), Nunjucks, and eventually Rework.
.
├── README.md
├── component.json
├── components (installed by Component(1))
├── components-data
│   ├── a-page.md
│   └── articles
├── components-local
│   ├── article
│   │   ├── article.css
@necolas
necolas / generated-ie-only.css
Last active August 29, 2015 13:56
Problem with extracting IE-specific CSS into separate stylesheet.
.a {
background: red;
}
@necolas
necolas / generated-ie.css
Last active August 29, 2015 13:56
Generating isolated IE-specific stylesheet
.a {
background: red;
/* dropped linear gradient based on IE CSS support (like what autoprefixer does) */
zoom: 1;
}
.b {
background: green;
}
@necolas
necolas / MyComponent.css
Created April 15, 2014 03:22
SUIT CSS spacing with variables
:root {
--margin-MyComponent-part: var(--theme-margin-small);
}
.MyComponent {}
.MyComponent-part {
margin: var(--margin-MyComponent-part);
}
var TweetBox = defineComponent(function() {
this.attributes({
charLimit: 140
withGeoControl: false;
});
if (withGeoControl === true) {
// attach to a sub node
this.child(GeoControl).attachTo('.GeoControl');
}
@necolas
necolas / output-after-css-change.md
Created August 30, 2014 17:07
Webpack hashing and file-loader bugs

about/index.css was changed. color: black -> color: blue.

Issues with output:

  • Same hash
  • Same chunkhash (messes with cache invalidation of CSS)
  • Another different publicPath coming from file-loader in the extracted CSS.

Webpack

@necolas
necolas / webpack-pre-css-loader.js
Created September 8, 2014 20:15
webpack-pre-css-loader.js
var path = require('path');
/**
* CSS transform dependencies
*/
var autoprefixer = require('autoprefixer-core');
var calc = require('rework-calc');
var color = require('rework-color-function');
var conformance = require('rework-suit-conformance');
@necolas
necolas / intern.config.js
Created September 8, 2014 20:58
Auto-generating the intern test config
/**
* Functional and Unit test configuration
*
* This configuration file has to work in both Node.js and browser environments.
* Therefore, this config is a template that is used to build the Intern config
* used to run the tests. The packages and suites are automatically defined.
*
* Learn more about configuring Intern at:
* https://github.com/theintern/intern/wiki/Configuring-Intern
*/