Initial commit.

This commit is contained in:
Alexandre Gigliotti
2015-07-22 15:51:14 -07:00
commit f8369f3bc0
8 changed files with 146 additions and 0 deletions

8
test/assets/imported.css Normal file
View File

@@ -0,0 +1,8 @@
body {
border: solid 4px green;
}
#import {
background-image: url('./person.png');
background-size: contain;
background-repeat: no-repeat;
}

BIN
test/assets/person.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

25
test/index.html Normal file
View File

@@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<style>
div {
padding-left: 2em;
}
</style>
<link rel="stylesheet/less" href="main.less"/>
<style>
#style {
background-image: url('./assets/person.png');
background-size: contain;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="link">Link</div>
<div id="import">Import</div>
<div id="style">Style</div>
<div id="attribute" style="background-image: url('./assets/person.png'); background-size: contain; background-repeat: no-repeat;">Attribute</div>
<img height="32px" width="32px" src="./assets/person.png"/>Image
</body>
</html>

15
test/index.js Normal file
View File

@@ -0,0 +1,15 @@
var inline = require('../lib');
var path = require('path');
var fs = require('fs');
var filepath = path.resolve(__dirname, './index.html');
var options = {};
/**
* html -> async -> inlined html
*/
inline(filepath, options)
.then(function (html) {
console.log(html);
fs.writeFileSync('./test.html', html);
})
.catch(console.error);

7
test/main.less Normal file
View File

@@ -0,0 +1,7 @@
@import (less) './assets/imported.css';
#link {
background-image: url('assets/person.png');
background-size: contain;
background-repeat: no-repeat;
}