0
I’m studying the implementation of Windows and vuejs and using as template the admin Lte. My question is: no index.html vuejs, I put all the base css and js files. But when the page requires a specific css and or js file, how do this include in the vuejs Component? Before I was doing everything in one place, now I separated the backend of the frontend. Not always will a js file have an export, especially in these cases web templates. What’s more, there is also the need to import css files to specific pages.
But when is a js of some template? For example, I am using adminlte as tests, some pages require specific js but which do not necessarily return a class but have several functions for a certain thing on that page. How to import this kind of js?
– Felipe Paz
Well, I’ve never tried with js inline, but require wouldn’t work?
– Felipe Duarte
Felipe, the times I tried didn’t work out. I end up loading ALL css and js in the index of Vue, which ends up generating an unnecessary extra load in the application.
– Felipe Paz
Sorry for the delay, but if you are using Webpack you need some settings to export external js, if I am not mistaken, you need loaders like https://webpack.js.org/loaders/script-Loader/ and also manage the distribution of Chunks to the pages that will actually use certain files, thus eliminating the loading of all at once.
– Felipe Duarte