How to push asset in Vite? - vite

I have somefile.css and I wanna vite just to add link to that file in index.html and push it in-to assets.
If I would just add file using import in App.vue than that would not be separate file and there will be no link to it in index.html...
How can I implement that?

Related

Vite and SvelteKit - Using multiple entry html files

I am just starting to get into SvelteKit and have a question regarding development and builds.
I am using the static adapter and I would like to have two entry points for my SvelteKit app.
One being the default index.html (src/app.html) and the other being other.html (other/app.html).
eg.
build
...
index.html
other.html
src
...
app.html
other
...
app.html
Is there a way using Vite or SvelteKit to have these two separate entries in the one build configuration?

How to have netlify to point to some other html in another folder?

I have a project for which the structure is like
-src(folder)
-static(folder)
-package.json
-package-lock
-webpack.config
my main index.html is in the src folder - src/index.html.
Is this the reason why when I click on the website I get "Page Not Found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site." ?
If yes then how can I fix that?
I figured it out.
Add a "netlify.toml" in your root folder along with your package.json etc files with this code-
[build]
base ="/"
publish = "src/"
pointing the publish folder to the folder with index.html file.

.env is not being read in create-react-app

I have created a react app using create-react-app. I'm using react-admin to develop my admin panel. I want to use some environment variables. Here's my .env file:
REACT_APP_API_URL=http://localhost:8000
REACT_APP_BRAND=Guli
REACT_APP_SLOGAN=Financial transactions, redefined
And I also have .env.test and .env.production for staging and production environments, and I only override API URL in those files.
Now I want to use these variables inside my react app. I'm using them inside index.html and DataProvider.js that I use for react-admin.
In index.html I use:
<title>%REACT_APP_BRAND%</title>
and in DataProvider I use:
const apiUrl = process.env.REACT_APP_API_URL;
// using apiUrl in the rest of DataProvider.js
The problem is that none of these variables are read from .env file. In index.html I see the title of my app to be exactly %REACT_APP_BRAND%, and the calls to my API go to undefined/users for example which means that process.env.REACT_APP_API_URL is not loaded.
What sould I do?

jhipster index.html not allowing changes

I created a jhipster ui only angular 6 app.
I now want to add a script to index.html:
<head>
...
<script src='widgets/widgets.js'></script>
</head>
When I run the index.html is copied to the build/www directory fine, but in the app my script tag or any other changes are not there.
Seems that webpack does not use my new version.
How do I get webpack to use the changed template?
You have to use webpack in order to achieve the script tag injection.
Add your script to the entry points of webpack in the entry property located in webpack.dev.js (or prod) file, then add the related key inside the chunks array of the HtmlWebpackPlugin (it is located in webpack.common file).
This should inject the script tag inside your index.html

How to add .js file to netsuite SCA Denali / Mont-Blanc

I am currently editing a Netsuite SCA implementation - and need to add a .js file to the site.
In SiteBuilder this was fairly simple with editing templates. However, with SCA it looks like we need quite a bit more configuration to make it happen.
I'd welcome some help from the community on how to add a .js file.
Thank you
If it is a third party module create a new directory for it under Modules/third_parties/MyModule#1.0.0
If its a custom javascript file create a new folder under Modules/MyCustomModules/MyModule#1.0.0
Create a JavaScript folder under MyModule#1.0.0/JavaScript and place your file in there.
Create a ns.package.json file at the root of MyModule#1.0.0, with the following contents:
{
"gulp": {
"javascript": [
"JavaScript/*"
]
},
"jshint": "false"
}
Open the distro.json file at the root of the SCA application and add your module to the modules object:
If you added your module to thrid_parties use:
"third_parties/MyModule":"1.0.0"
If you added a new MyCustomModules folder use:
"MyCustomModules/MyModule":"1.0.0"
Then add MyModule to the dependencies object in the distro.json for each application. E.g. if you only use the js file in the shopping application, add it to the dependencies object for the SC.Shopping.Starter entrypoint.
Then gulp deploy to deploy your new module

Resources