Reputation: 63
I'm developing a liferay 7.1 theme, based on bootstrap, using the theme generator.
With regard to JS, I have a directory /src/js/plugins containing several .js files, each corresponding to a different component (dropdown.js, list.js, ...).
Now, from the Liferay documentation, I saw that the javascript custom code should be inserted in the main.js file.
So, I ask you, how do I put all javascript files in the theme? What is the correct procedure?
PS. Building the bootstrap theme, a javascript min file is produced. Can I copy this js file in the main.js file? Or is there a better procedure, importing individual files?
Thank you
Francesco
Upvotes: 0
Views: 1584
Reputation: 3698
In your theme you are free to create the structure you need for your JS, as long you do not override elements from the parent theme. you can check the final result in the build folder. An option is to use your src/js folder and to include in templates you can use:
<script src="${javascript_folder}/example.js"></script>
Considering that you have something like this in your init:
<#assign
css_folder = theme_display.getPathThemeCss()
images_folder = theme_display.getPathThemeImages()
javascript_folder = theme_display.getPathThemeJavaScript()
templates_folder = theme_display.getPathThemeTemplates()
full_css_path = fullCssPath
full_templates_path = fullTemplatesPath
/>
Upvotes: 1