mirror of
https://github.com/KevinMidboe/inline-html.git
synced 2025-10-29 17:40:29 +00:00
Refactored.
This commit is contained in:
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
4
test/index.html → test/fixtures/index.html
vendored
4
test/index.html → test/fixtures/index.html
vendored
@@ -1,13 +1,11 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet/less" href="main.less"/>
|
||||
<style>
|
||||
div {
|
||||
padding-left: 2em;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet/less" href="main.less"/>
|
||||
<style>
|
||||
#style {
|
||||
background-image: url('./assets/person.png');
|
||||
background-size: contain;
|
||||
@@ -2,11 +2,9 @@ var inline = require('../lib');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var filepath = path.resolve(__dirname, './index.html');
|
||||
var filepath = path.resolve(__dirname, './fixtures/index.html');
|
||||
var options = {};
|
||||
/**
|
||||
* html -> async -> inlined html
|
||||
*/
|
||||
|
||||
inline(filepath, options)
|
||||
.then(function (html) {
|
||||
console.log(html);
|
||||
|
||||
7
test/inline-css-url.js
Normal file
7
test/inline-css-url.js
Normal file
@@ -0,0 +1,7 @@
|
||||
var inline = require('../lib/inline-css-url');
|
||||
var fs = require('fs');
|
||||
|
||||
var filePath = './fixtures/assets/imported.css';
|
||||
var css = fs.readFileSync(filePath, 'utf8');
|
||||
css = inline(css, filePath);
|
||||
console.log(css);
|
||||
10
test/inline-link-less.js
Normal file
10
test/inline-link-less.js
Normal file
@@ -0,0 +1,10 @@
|
||||
var inline = require('../lib/inline-link-less');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var filepath = path.resolve(__dirname, './fixtures/index.html');
|
||||
var html = fs.readFileSync(filepath, 'utf8');
|
||||
|
||||
inline(html, filepath, {})
|
||||
.then(console.log)
|
||||
.catch(console.error);
|
||||
Reference in New Issue
Block a user