Skip to content
New issue

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

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

Already on GitHub? # to your account

[Rails] Where to add the dependent JS files? #24

Open
lokeshh opened this issue Jun 19, 2017 · 4 comments
Open

[Rails] Where to add the dependent JS files? #24

lokeshh opened this issue Jun 19, 2017 · 4 comments

Comments

@lokeshh
Copy link
Member

lokeshh commented Jun 19, 2017

From the README:

`In view, add the required JS files (for the plotting library), in head tag (generally) using the line , e.g. : Daru::View.dependent_script(:highcharts)

Could you mention specifically where this line needs to be added?

@lokeshh
Copy link
Member Author

lokeshh commented Jun 19, 2017

Further I think it would be great if you first create an app in another repo. Then add a commit showing changes through which that app can use daru-view. Then you can link that commit here in the README. It would precisely show us that in which places what lines need to be added. This step is not necessary but would be good to have.

@Shekharrajak
Copy link
Member

The line <%=raw Daru::View.dependent_script(:highcharts) %> for rails app , must be added in the layout file of the application. Like this example : https://github.com/Shekharrajak/daru-view/blob/master/spec/dummy_rails/app/views/layouts/highcharts_layout.html.erb#L11

I will create separate Rails app. Thanks for suggestions.

@lokeshh
Copy link
Member Author

lokeshh commented Aug 1, 2017

@Shekharrajak I am not sure if this would be feasible but could you replace <%=raw Daru::View.dependent_script(:highcharts) %> with //= require highcharts. See this for example https://github.com/twbs/bootstrap-rubygem

@Shekharrajak
Copy link
Member

Sometime I also feel that because of Daru::View.dependent_script(:highcharts) it is filling thousands of lines on js code in web page. Will it be good if we load whole js (google charts js , highcharts js) as //= require highcharts in Rails ? If yes then need to use similar thing for sinatra and Nanoc web application.

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

No branches or pull requests

2 participants