exporting bel/raw via choo/html/raw (#565)

This commit is contained in:
Maciej Sitko
2017-09-19 19:43:37 +01:00
committed by GitHub
parent 5a5723561b
commit ef3b372e23
4 changed files with 8 additions and 4 deletions
View File
+1
View File
@@ -0,0 +1 @@
module.exports = require('bel/raw')
+3 -2
View File
@@ -5,13 +5,14 @@
"main": "index.js", "main": "index.js",
"files": [ "files": [
"index.js", "index.js",
"html.js", "html/index.js",
"html/raw.js",
"dist", "dist",
"example" "example"
], ],
"scripts": { "scripts": {
"build": "mkdir -p dist/ && browserify index -p bundle-collapser/plugin > dist/bundle.js && browserify index -g unassertify -g uglifyify -p bundle-collapser/plugin | uglifyjs --mangle-props -c unsafe,properties,dead_code,comparisons,evaluate,hoist_funs,if_return,join_vars,pure_getters,reduce_vars,collapse_vars --toplevel > dist/bundle.min.js && cat dist/bundle.min.js | gzip --best --stdout | wc -c | pretty-bytes", "build": "mkdir -p dist/ && browserify index -p bundle-collapser/plugin > dist/bundle.js && browserify index -g unassertify -g uglifyify -p bundle-collapser/plugin | uglifyjs --mangle-props -c unsafe,properties,dead_code,comparisons,evaluate,hoist_funs,if_return,join_vars,pure_getters,reduce_vars,collapse_vars --toplevel > dist/bundle.min.js && cat dist/bundle.min.js | gzip --best --stdout | wc -c | pretty-bytes",
"deps": "dependency-check --entry ./html.js . && dependency-check . --extra --no-dev --entry ./html.js", "deps": "dependency-check --entry ./html/index.js . && dependency-check . --extra --no-dev --entry ./html/index.js",
"inspect": "browserify --full-paths index -g unassertify -g uglifyify | discify --open", "inspect": "browserify --full-paths index -g unassertify -g uglifyify | discify --open",
"prepublish": "npm run build", "prepublish": "npm run build",
"start": "bankai start example", "start": "bankai start example",
+4 -2
View File
@@ -1,17 +1,19 @@
var tape = require('tape') var tape = require('tape')
var html = require('./html') var html = require('./html')
var raw = require('./html/raw')
var choo = require('./') var choo = require('./')
tape('should render on the server', function (t) { tape('should render on the server', function (t) {
var app = choo() var app = choo()
app.route('/', function (state, emit) { app.route('/', function (state, emit) {
var strong = '<strong>Hello filthy planet</strong>'
return html` return html`
<p>Hello filthy planet</p> <p>${raw(strong)}</p>
` `
}) })
var res = app.toString('/') var res = app.toString('/')
var exp = '<p>Hello filthy planet</p>' var exp = '<p><strong>Hello filthy planet</strong></p>'
t.equal(res.toString().trim(), exp, 'result was OK') t.equal(res.toString().trim(), exp, 'result was OK')
t.end() t.end()
}) })