user1134181
user1134181

Reputation:

How to add html-file with JavaScript code in template Slim?

There are HTML-file that contains JavaScript code. This JavaScript code loads an image and positioning it in a certain place. If failed, a message displays.

I need to include this file in template Slim.

I can include one Slim template to another by the following:

=render 'some/path/some_pattern'

How to include HTML- file to my template Slim?

Upvotes: 5

Views: 10553

Answers (1)

Danny
Danny

Reputation: 6025

The best way to add some javascript to your slim file is either by including the javascript file using

= javascript_include_tag 'name of the file' 

or by directly adding the javascript code to your slim file, using

javascript:
  code line 1
  code line 2
  ...

Upvotes: 11

Related Questions