Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Last active December 22, 2016 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhodgins/f862a50fa1b6fe35f16b808e8eb889bd to your computer and use it in GitHub Desktop.
Save tomhodgins/f862a50fa1b6fe35f16b808e8eb889bd to your computer and use it in GitHub Desktop.
EQCSS + Browserify example
<title>EQCSS + Browserify Example</title>
<!-- Test EQCSS -->
<style>
html {
background: red;
}
@element 'html' {
$this {
background: lime;
}
}
</style>
<p>If the background is green, EQCSS is running.</p>
<script src=bundle.js></script>
{
"name": "browserify-test",
"version": "1.0.0",
"description": "Basic use of EQCSS with Webpack",
"main": "test.js",
"scripts": {
"build": "browserify ./test.js -o ./bundle.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Tommy Hodgins",
"license": "MIT",
"dependencies": {
"eqcss": "^1.4.0",
"browserify": "^13.1.1"
}
}
// Include EQCSS
var eqcss = require('eqcss')
// Check access to EQCSS.apply()
if (typeof EQCSS.apply()) {
console.log('Browserify can access EQCSS.apply()')
}
// Check access to EQCSS.throttle()
if (typeof EQCSS.throttle()) {
console.log('Browserify can access EQCSS.throttle()')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment