Skip to content

Commit 419824a

Browse files
committed
🚀 initial commit!
0 parents  commit 419824a

File tree

12 files changed

+327
-0
lines changed

12 files changed

+327
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[{package.json,.*rc,*.yml}]
11+
indent_style = space
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md

.eslintrc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "eslint:recommended",
4+
"env": {
5+
"browser": true,
6+
"mocha": true,
7+
"es6": true
8+
},
9+
"parserOptions": {
10+
"ecmaFeatures": {
11+
"modules": true,
12+
"jsx": true
13+
}
14+
},
15+
"globals": {
16+
"require": true
17+
},
18+
"rules": {
19+
"no-empty": 0,
20+
"no-console": 0,
21+
"no-unused-vars": [0, { "varsIgnorePattern": "^h$" }],
22+
"no-cond-assign": 1,
23+
"semi": 2,
24+
"camelcase": 0,
25+
"comma-style": 2,
26+
"comma-dangle": [2, "never"],
27+
"indent": [2, "tab", {"SwitchCase": 1}],
28+
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
29+
"no-trailing-spaces": [2, { "skipBlankLines": true }],
30+
"max-nested-callbacks": [2, 3],
31+
"no-eval": 2,
32+
"no-implied-eval": 2,
33+
"no-new-func": 2,
34+
"guard-for-in": 2,
35+
"eqeqeq": 1,
36+
"no-else-return": 2,
37+
"no-redeclare": 2,
38+
"no-dupe-keys": 2,
39+
"radix": 2,
40+
"strict": [2, "never"],
41+
"no-shadow": 0,
42+
"no-delete-var": 2,
43+
"no-undef-init": 2,
44+
"no-shadow-restricted-names": 2,
45+
"handle-callback-err": 0,
46+
"no-lonely-if": 2,
47+
"keyword-spacing": 2,
48+
"constructor-super": 2,
49+
"no-this-before-super": 2,
50+
"no-dupe-class-members": 2,
51+
"no-const-assign": 2,
52+
"prefer-spread": 2,
53+
"no-useless-concat": 2,
54+
"no-var": 2,
55+
"object-shorthand": 2,
56+
"prefer-arrow-callback": 2
57+
}
58+
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/dist
2+
/node_modules
3+
/npm-debug.log
4+
.DS_Store

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.eslintrc

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
language: node_js
2+
node_js:
3+
- 4

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Jason Miller
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# vhtml
2+
3+
[![NPM](https://img.shields.io/npm/v/vhtml.svg?style=flat)](https://www.npmjs.org/package/vhtml)
4+
[![travis-ci](https://travis-ci.org/developit/vhtml.svg?branch=master)](https://travis-ci.org/developit/vhtml)
5+
6+
### **Render JSX/Hyperscript to HTML strings, without VDOM**
7+
8+
> Need to use HTML strings (angular?) but want to use JSX? vhtml's got your back.
9+
10+
11+
---
12+
13+
14+
## Installation
15+
16+
Via npm:
17+
18+
`npm install --save vhtml`
19+
20+
21+
---
22+
23+
24+
## Usage
25+
26+
```js
27+
// import the library:
28+
import h from 'vhtml';
29+
30+
// tell babel to transpile JSX to h() calls:
31+
/** @jsx h */
32+
33+
// now render JSX to an HTML string!
34+
let items = ['one', 'two', 'three'];
35+
36+
document.body.innerHTML = (
37+
<div class="foo">
38+
<h1>Hi!</h1>
39+
<p>Here is a list of {items.length} items:</p>
40+
<ul>
41+
{ items.map( item => (
42+
<li>{ item }</li>
43+
)) }
44+
</ul>
45+
</div>
46+
);
47+
```

package.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"name": "vhtml",
3+
"amdName": "vhtml",
4+
"version": "1.0.0",
5+
"description": "Hyperscript reviver that constructs a sanitized HTML string.",
6+
"main": "dist/vhtml.js",
7+
"minified:main": "dist/vhtml.min.js",
8+
"jsnext:main": "src/vhtml.js",
9+
"scripts": {
10+
"build": "npm-run-all transpile minify size",
11+
"transpile": "rollup -c rollup.config.js",
12+
"minify": "uglifyjs $npm_package_main -cm -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map",
13+
"size": "echo \"gzip size: $(gzip-size $npm_package_minified_main | pretty-bytes)\"",
14+
"test": "eslint {src,test} && mocha --compilers js:babel-register test/**/*.js",
15+
"prepublish": "npm-run-all build test",
16+
"release": "npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
17+
},
18+
"babel": {
19+
"presets": [
20+
"es2015-minimal",
21+
"stage-0",
22+
"react"
23+
],
24+
"plugins": [
25+
"transform-object-rest-spread",
26+
[
27+
"transform-react-jsx",
28+
{
29+
"pragma": "h"
30+
}
31+
]
32+
]
33+
},
34+
"keywords": [
35+
"hyperscript",
36+
"html",
37+
"renderer",
38+
"strings"
39+
],
40+
"repository": {
41+
"type": "git",
42+
"url": "git+https://github.com/developit/vhtml.git"
43+
},
44+
"author": "Jason Miller <jason@developit.ca>",
45+
"license": "MIT",
46+
"bugs": {
47+
"url": "https://github.com/developit/vhtml/issues"
48+
},
49+
"homepage": "https://github.com/developit/vhtml",
50+
"devDependencies": {
51+
"babel-core": "^6.6.4",
52+
"babel-eslint": "^5.0.0",
53+
"babel-plugin-transform-object-rest-spread": "^6.6.4",
54+
"babel-plugin-transform-react-jsx": "^6.6.5",
55+
"babel-preset-es2015-minimal": "^1.1.0",
56+
"babel-preset-es2015-minimal-rollup": "^1.1.0",
57+
"babel-preset-react": "^6.5.0",
58+
"babel-preset-stage-0": "^6.5.0",
59+
"babel-register": "^6.7.2",
60+
"chai": "^3.5.0",
61+
"eslint": "~2.2.0",
62+
"gzip-size-cli": "^1.0.0",
63+
"mkdirp": "^0.5.1",
64+
"mocha": "^2.4.5",
65+
"npm-run-all": "^1.5.1",
66+
"pretty-bytes-cli": "^1.0.0",
67+
"rollup": "^0.25.4",
68+
"rollup-plugin-babel": "^2.4.0",
69+
"uglify-js": "^2.6.2"
70+
}
71+
}

rollup.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import path from 'path';
2+
import fs from 'fs';
3+
import babel from 'rollup-plugin-babel';
4+
5+
let pkg = JSON.parse(fs.readFileSync('./package.json'));
6+
let external = Object.keys(pkg.peerDependencies || {}).concat(Object.keys(pkg.dependencies || {}));
7+
8+
export default {
9+
entry: pkg['jsnext:main'],
10+
dest: pkg.main,
11+
sourceMap: path.resolve(pkg.main),
12+
moduleName: pkg.amdName,
13+
format: 'umd',
14+
external,
15+
plugins: [
16+
babel({
17+
babelrc: false,
18+
comments: false,
19+
exclude: 'node_modules/**',
20+
presets: [
21+
'es2015-minimal-rollup'
22+
].concat(pkg.babel.presets.slice(1)),
23+
plugins: require('babel-preset-es2015-minimal-rollup').plugins.concat([
24+
['transform-react-jsx', { pragma:'h' }]
25+
])
26+
})
27+
]
28+
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy