Using the HubSpot CMS, you can create advanced JS-based web applications. There are boilerplates available to make it easier to get up and running.
Module.css
and module.js
is automatically minified.{ }
to delimit their code. The HubL language uses these braces, as well. There are three strategies you can use to ensure you don’t have conflicts between your framework and HubL: You can use the raw HubL tag to wrap around your JSX, set the framework to use a different delimiter, or use a build step that compiles the JavaScript beforehand.
module.html
file, use require_js
to add the Vue library ensuring it will only load once when your module is added to a page.
module.html
file. Wrap this code in a HubL raw tag to prevent it from being evaluated as HubL.
module.js
. Wrap this code in an event listener to ensure it’s executed once the DOM content has finished loading. Publish your module, and preview it. You should now see your basic Vue app working.
hs create vue-app
command from the CMS CLI. Directions can be found in the repository.
This boilerplate is new and we would love to hear your feedback! Let us know what could be improved and any issues you encounter. The best way to provide feedback is by submitting issues to the GitHub repository.
v-once
to that element. This ensures the code will be rendered once and then ignored by your Vue component.
hs create react-app
command from the CMS CLI. From there follow the instructions in the repository.
This boilerplate is new and we would love to hear your feedback! Let us know what could be improved and any issues you run into. The best way to provide feedback is by submitting issues to the GitHub repository.
require_js
HubL function. Scripts loaded using this function will only load once per page regardless of how many modules, partials, and the template, requires them.
get_asset_url()
to require files stored within the developer file system. The advantage aside from just co-locating your development files and consolidating security of these files, is that it will result in fewer DNS lookups.