Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default style when using the CLI #205

Merged
merged 3 commits into from
Sep 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/mermaid.css
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,5 @@ text {
}

.mermaid {
width:1200px;
width: auto;
}
2 changes: 2 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ cli.prototype.parse = function(argv, next) {
} catch (err) {
this.errors.push(err)
}
} else {
options.css = fs.readFileSync(__dirname + '/../dist/mermaid.css')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer this use node's path.join to ensure it remains cross-platform safe. you'll need to var path = require('path') at the top of the file, and then this line becomes:

options.css = fs.readFileSync(path.join(__dirname, '..', 'dist', 'mermaid.css'))

}

this.checkPhantom = createCheckPhantom(options.phantomPath)
Expand Down
11 changes: 11 additions & 0 deletions test/cli_test-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ test('setting an output directory succeeds', function(t) {
})
})

test('not setting a css source file uses a default style', function(t) {
t.plan(1)

var cli = require(cliPath)

cli.parse([], function(err, msg, opt) {
t.ok(opt.css, 'css file is populated')
t.end()
})
})

test('setting a css source file succeeds', function(t) {
t.plan(1)

Expand Down