Skip to content

Commit

Permalink
Merge pull request #106 from preactjs/pretty_render
Browse files Browse the repository at this point in the history
Fix pretty option doing nothing
  • Loading branch information
marvinhagemeister authored Jul 11, 2019
2 parents 470f098 + f35acb8 commit 53baf2c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion env.js

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"jsnext:main": "dist/index.module.js",
"scripts": {
"build": "npm run -s transpile && npm run -s transpile:jsx && npm run -s copy-typescript-definition",
"transpile": "echo 'export const ENABLE_PRETTY = false;'>env.js && microbundle src/index.js -f es,umd --target web --external preact",
"transpile:jsx": "echo 'export const ENABLE_PRETTY = true;'>env.js && microbundle src/jsx.js -o dist/jsx.js --target web --external none && microbundle dist/jsx.js -o dist/jsx.js -f cjs",
"transpile": "microbundle src/index.js -f es,umd --target web --external preact",
"transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external none && microbundle dist/jsx.js -o dist/jsx.js -f cjs",
"copy-typescript-definition": "copyfiles -f src/index.d.ts dist",
"test": "eslint src test && tsc && mocha --compilers js:babel-register test/**/*.js",
"prepublish": "npm run build",
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { encodeEntities, indent, isLargeString, styleObjToCss, assign, getChildren } from './util';
import { ENABLE_PRETTY } from '../env';
import { options, Fragment, createElement } from 'preact';

const SHALLOW = { shallow: true };
Expand Down Expand Up @@ -50,7 +49,7 @@ function renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {
context = context || {};
opts = opts || {};

let pretty = ENABLE_PRETTY && opts.pretty,
let pretty = opts.pretty,
indentChar = pretty && typeof pretty==='string' ? pretty : '\t';

// #text nodes
Expand Down

0 comments on commit 53baf2c

Please sign in to comment.