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

Missing semicolon breaks JavaScript when minified #719

Open
carpiediem opened this issue Oct 18, 2016 · 2 comments
Open

Missing semicolon breaks JavaScript when minified #719

carpiediem opened this issue Oct 18, 2016 · 2 comments

Comments

@carpiediem
Copy link

I used nPlot to generate a nvd3 plot and it rendered beautifully with knittr. However, when the HTML file was later minified by GitHub Pages jekyll code, the newline that formerly separated two JavaScript statements was no longer there. If rCharts included a semicolon at the end of the data array, everything should work perfectly.

ballots_by_choice_plot <- rCharts::nPlot(Freq ~ vote, data = ballots_by_choice, type = 'pieChart')

Portion of rendered HTML:

{
 "vote": "No",
"Freq": 129763
},
{
 "vote": "Yes",
"Freq": 51821
}
]

      if(!(opts.type==="pieChart" || opts.type==="sparklinePlus" || opts.type==="bulletChart")) {
        var data = d3.nest()

Matching portion of minified HTML

{ "vote": "No", "Freq": 129763 }, { "vote": "Yes", "Freq": 51821 } ] if(!(opts.type==="pieChart" || opts.type==="sparklinePlus" || opts.type==="bulletChart")) { var data = d3.nest()

Should be

{ "vote": "No", "Freq": 129763 }, { "vote": "Yes", "Freq": 51821 } ]; if(!(opts.type==="pieChart" || opts.type==="sparklinePlus" || opts.type==="bulletChart")) { var data = d3.nest()
@carpiediem
Copy link
Author

Is the solution simply to edit line 7 here?

@carpiediem
Copy link
Author

carpiediem commented Oct 19, 2016

I was able to get my MD file to render on GitHub pages, but it required several semicolons to be added and a pair of JavaScript comments to be deleted. I'll make a pull request that should address all the issues.

See #720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant