Closed omvaishnav closed 10 months ago
Inclusion of the script is of course dependant on the individual project setup. The example use-case in the README is illustrational.
Please make sure that the smartbanner.min.js
and smartbanner.min.css
are placed with the rest of your CSS and JS assets so that the files are publicly accessible for end-users.
Do we need to manually copy both files from the package and place them in the assets folder? If that's the case, what happens when the package receives updates to these files? Is there a more efficient way to handle updates and ensure that our assets stay synchronized with the package changes?
It's a task that your local setup has to consider during the build and/or asset compilation. Exposing gigabytes of node_modules
to public is not a good idea.
Thank you, Ain, for providing clarification. I have an additional question. Is there a way to configure a global class for either the <html>
or <body>
tag when the smart banner is active?
Good question.
It is not directly possible, but what you could do is:
body
or html
, but to the wrapper element which smartbanner is added to.init
of smartbanner and add the global class to html
or body
automatically whenever you have the smartbanner added, e.g.:document.addEventListener('smartbanner.init', javascript_function_to_add_class_to_body);
Steps to reproduce:
What happens: Files not included properly and showing error - Uncaught SyntaxError: Unexpected token '<' (at smartbanner.min.js:1:1)
What should happen: both js and css files should be exported from the package.
How can we give direct node_modules package file path as it's outside of root?