Skip to content

Commit fdf537c

Browse files
committed
Merge pull request #1 from rayd/new-npm-package
New npm package for the fork of the project.
2 parents 161557d + 762bcd3 commit fdf537c

File tree

3 files changed

+36
-26
lines changed

3 files changed

+36
-26
lines changed

.travis.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
language: node_js
22
node_js:
3-
- "0.10"
4-
3+
- '5'
54
before_install:
6-
- "export DISPLAY=:99.0"
7-
- "sh -e /etc/init.d/xvfb start"
8-
9-
script: "npm run-script test-ci"
10-
11-
env:
12-
global:
13-
- secure: nQ9ciBKFWAbg6W0RlikyhgLgQF8PMhPbNaIFGC7zwkJ+1iOslYYYbE2Ve959v5fvX6TdCMiQRjzsZoH5PC+IdSxRJWau23m/6r8yRPKhouLAkHAEgRMEMHzOdVkk/HxYxtnMdJ9MfY58wjBfxAX0WR4W7TydUkLL6DLfUYZauTs=
14-
- secure: OKuVsB6Y19yGsRLkaKOXG3yOJouSCkzuVYrjBHahhZ3pCVFHY3829zEkeI1jZ0QcHSqIYhqpAFhrjLSEafqVQOTSkEjetQOPKTf4mPFBlxwSAgmFJocUEPnKpKuyYTorhddrM5kDrHcq1zscgwAaToamabIN7Pt9ykjPtvUb9b8=
15-
5+
- 'export DISPLAY=:99.0'
6+
- sh -e /etc/init.d/xvfb start
7+
script: npm run-script test-ci
168
addons:
179
sauce_connect: true
10+
env:
11+
global:
12+
- secure: >-
13+
nfXTzJG2vq9LHVj4+xm0RmXlX9BBkUwr404GN+C8jL+fbUwMfSOv4VOj11PmhH8EHAVnBw1R/vTWucNYbTH2IAw2iUgDZ0N+InKAT94MiVcwgBuwwQmCqtH10qMExXhNK/mnLMDF/fuJyRD57xL165e3mN1D57UkuxfkOjz102zK+LKKTgupHe8ujsWO9BzMMvQzCmzfvzbYko+rtYmjjipnyjgMCjCzIO0akt5sVx7CM1ops+hxeOG4liHeJRrYkd+b7m4NKrZd+lX4TKmnCKt9AcmcOzqiXycW2RBuQB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khC+Gy97JFzkU=

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
# html-parse-stringify
1+
# html-parse-stringify2
2+
3+
## Quick note
4+
5+
This is a fork of [html-parse-stringify](https://github.com/HenrikJoreteg/html-parse-stringify) that I made because I wanted to get some important fixes into the repo and available as an NPM package and I'm not sure whether the old repo is still being maintained. Hence this. This could be temporary - I'll gladly drop this if activity picks back up on the original repo. But for now we've got a new npm package `html-parse-stringify2`. Install with:
6+
7+
```
8+
npm install --save html-parse-stringify2
9+
```
10+
11+
Use as documented below...
12+
13+
### OK, on to the original README...
214

315
This is an *experimental lightweight approach* to enable quickly parsing HTML into an AST and stringify'ing it back to the original string.
416

@@ -10,25 +22,25 @@ Why yes, yes I have :)
1022

1123
But the truth is. If you *could* do this in a whopping grand total of ~600 bytes (min+gzip) as this repo shows. It potentially enables DOM diffing based on a HTML strings to be super light and fast in a browser. What is that you say? DOM-diffing?
1224

13-
Yes.
25+
Yes.
1426

1527
React.js essentially pioneered the approach. With Reach you render to a "virtual DOM" whenever you want to, and the virtual DOM can then diff against the real DOM (or the last virtual DOM) and then turn that diff into whatever transformations are necessary to get the *real* DOM to match what you rendered as efficiently as possible.
1628

1729
As a result, when you're building a single page app, you don't have to worry so much about bindings. Instead, you simple re-render to the virtual DOM whenever you know something's changed. All of a sudden being able to have `change` events for individual properties becomes less important, instead you can just reference those values in your template whenever you think something changed.
1830

1931
Cool idea, right?!
2032

21-
## So why this?
33+
## So why this?
2234

23-
Well, there are other things React expects me to do if I use it that I don't like. Such as the custom templating and syntax you have to use.
35+
Well, there are other things React expects me to do if I use it that I don't like. Such as the custom templating and syntax you have to use.
2436

25-
If, hypothetically, you could instead diff an HTML string (generated by *whatever* templating language of your choice) against the DOM, then you'd get the same benefit, sans React's impositions.
37+
If, hypothetically, you could instead diff an HTML string (generated by *whatever* templating language of your choice) against the DOM, then you'd get the same benefit, sans React's impositions.
2638

2739
This may all turn out to be a bad idea altogether, but initial results seem promising when paired with [virtual-dom](https://github.com/Matt-Esch/virtual-dom).
2840

2941
But you can't just diff HTML strings, as simple strings, very easily, in order to diff two HTML node trees you have to first turn that string into a tree structure of some sort. Typically, the thing you generate from parsing something like this is called an AST (abstract syntax tree).
3042

31-
This lib does exactly that.
43+
This lib does exactly that.
3244

3345
It has two methods:
3446

@@ -48,7 +60,7 @@ Takes an AST and turns it back into a string of HTML.
4860
See comments in the following example:
4961

5062
```js
51-
var HTML = require('html-parse-stringify')
63+
var HTML = require('html-parse-stringify2')
5264

5365
// this html:
5466
var html = '<div class="oh"><p>hi</p></div>';
@@ -65,7 +77,7 @@ console.log(ast);
6577
6678
// name of tag if relevant
6779
name: 'div',
68-
80+
6981
// parsed attribute object
7082
attrs: {
7183
class: 'oh'
@@ -137,7 +149,7 @@ properties:
137149

138150
## credits
139151

140-
If this sounds interesting you should probably follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) and [@Philip_Roberts](twitter.com/philip_roberts) on twitter to see how this all turns out.
152+
If this sounds interesting you should probably follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) and [@Philip_Roberts](twitter.com/philip_roberts) on twitter to see how this all turns out.
141153

142154
## license
143155

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "html-parse-stringify",
2+
"name": "html-parse-stringify2",
33
"description": "Parses well-formed HTML (meaning all tags closed) into an AST and back. quickly.",
44
"version": "1.0.2",
5-
"author": "Henrik Joreteg <[email protected]>",
5+
"author": "Ray Di Ciaccio <[email protected]>",
66
"bugs": {
7-
"url": "https://github.com/henrikjoreteg/html-parse-stringify/issues"
7+
"url": "https://github.com/rayd/html-parse-stringify2/issues"
88
},
99
"dependencies": {
1010
"void-elements": "^1.0.0"
@@ -18,7 +18,7 @@
1818
"tape": "^3.0.3",
1919
"zuul": "^1.16.5"
2020
},
21-
"homepage": "https://github.com/henrikjoreteg/html-parse-stringify",
21+
"homepage": "https://github.com/rayd/html-parse-stringify2",
2222
"keywords": [
2323
"html",
2424
"parse",
@@ -29,7 +29,7 @@
2929
"main": "index.js",
3030
"repository": {
3131
"type": "git",
32-
"url": "https://github.com/henrikjoreteg/html-parse-stringify"
32+
"url": "https://github.com/rayd/html-parse-stringify2"
3333
},
3434
"scripts": {
3535
"start": "run-browser test/*",

0 commit comments

Comments
 (0)