Comparing version 1.0.0-alpha2 to 1.0.0-alpha3
@@ -5,2 +5,8 @@ # Change Log | ||
## [1.0.0-alpha3] - 2016-05-18 | ||
### Added | ||
- Node.js module as option file is supported as well. | ||
- Some examples have been added to the documentation on how to use `-O`. | ||
## [1.0.0-alpha2] - 2016-05-18 | ||
@@ -58,3 +64,4 @@ | ||
[unreleased]: https://github.com/pugjs/pug-cli/compare/0.1.1...master | ||
[unreleased]: https://github.com/pugjs/pug-cli/compare/1.0.0-alpha3...master | ||
[1.0.0-alpha3]: https://github.com/pugjs/pug-cli/compare/1.0.0-alpha2...1.0.0-alpha3 | ||
[1.0.0-alpha2]: https://github.com/pugjs/pug-cli/compare/1.0.0-alpha1...1.0.0-alpha2 | ||
@@ -61,0 +68,0 @@ [1.0.0-alpha1]: https://github.com/pugjs/pug-cli/compare/0.1.1...1.0.0-alpha1 |
32
index.js
@@ -61,2 +61,14 @@ #!/usr/bin/env node | ||
console.log(''); | ||
console.log(' # Specify options through a string:'); | ||
console.log(' $ pug -O \'{"doctype": "html"}\' foo.pug'); | ||
console.log(' # or, using JavaScript instead of JSON'); | ||
console.log(' $ pug -O "{doctype: \'html\'}" foo.pug'); | ||
console.log(''); | ||
console.log(' # Specify options through a file:'); | ||
console.log(' $ echo "exports.doctype = \'html\';" > options.js'); | ||
console.log(' $ pug -O options.js foo.pug'); | ||
console.log(' # or, JSON works too'); | ||
console.log(' $ echo \'{"doctype": "html"}\' > options.json'); | ||
console.log(' $ pug -O options.json foo.pug'); | ||
console.log(''); | ||
}); | ||
@@ -77,13 +89,17 @@ | ||
function parseObj (input) { | ||
var str; | ||
try { | ||
str = fs.readFileSync(program.obj, 'utf8'); | ||
return require(path.resolve(input)); | ||
} catch (e) { | ||
str = program.obj; | ||
var str; | ||
try { | ||
str = fs.readFileSync(program.obj, 'utf8'); | ||
} catch (e) { | ||
str = program.obj; | ||
} | ||
try { | ||
return JSON.parse(str); | ||
} catch (e) { | ||
return eval('(' + str + ')'); | ||
} | ||
} | ||
try { | ||
return JSON.parse(str); | ||
} catch (e) { | ||
return eval('(' + str + ')'); | ||
} | ||
} | ||
@@ -90,0 +106,0 @@ |
{ | ||
"name": "pug-cli", | ||
"version": "1.0.0-alpha2", | ||
"version": "1.0.0-alpha3", | ||
"description": "Pug's CLI interface", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -67,2 +67,20 @@ # pug-cli | ||
Specify options through a string: | ||
``` | ||
$ pug -O '{"doctype": "html"}' foo.pug | ||
# or, using JavaScript instead of JSON | ||
$ pug -O "{doctype: 'html'}" foo.pug | ||
``` | ||
Specify options through a file: | ||
``` | ||
$ echo "exports.doctype = 'html';" > options.js | ||
$ pug -O options.js foo.pug | ||
# or, JSON works too | ||
$ echo '{"doctype": "html"}' > options.json | ||
$ pug -O options.json foo.pug | ||
``` | ||
## Installation | ||
@@ -69,0 +87,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
38717
14
780
92
11
4