When using Vite (SvelteKit) there's a hash appended to filenames when building so that the file is unique based on its contents (for example: _page.svelte-8f3ed184.js).
Currently when I run the vite build (or npm run build) the new files are built but the old files are cleared from the build folder. I would like to keep all files in the build folder on each built so that users that are currently browsing the site can still retrieve the previous build until the next time they come to the site (which would load the newer built).
Is there a setting for this in Vite? I haven't been able to find it.
Example
Build 1
"+page.svelte" file creates _page.svelte-8f3ed184.js
Build 2 ("+page.svelte" file was modified)
"+page.svelte" file creates _page.svelte-9j2dus3s.js
Currently after Build 2 only the second file is in the folder:
ls build/client/_app/immutable/components/pages/question
_page.svelte-9j2dus3s.js
What I'm looking for is after Build 2 both files are in the folder:
ls build/client/_app/immutable/components/pages/question
_page.svelte-8f3ed184.js
_page.svelte-9j2dus3s.js
Related
I have browser cache issue as from 1st build to 30 builds all the recent files are been storing in the path which are not been removed. How can I achieve when the build is successful previous file should be deleted from the location and new build files to be added.
Your inputs are Appreciated.
When I'm in a workspace and open an external file (from outside of workspace) in VSCode, how can I exclude this file from lint? More specifically from pug-lint but the same applies to ESLint?
The thing is that I want to exclude all files from outside my project (workspace), as in: if ./ is my project root folder, I want to exclude everything out of this (.././). This happens if I'm working in a project and open some file from outside that project, and ESLint starts working on it and messaging me about lint errors...I would like to avoid this clutter.
I developed an application in angular2 and now I need to deploy it.
Currently I have a wwww root folder containing:
html files
js files (generated from typescript)
css files (generated from scss)
/node_modules/ folders
/bower_componenets/ folder
The last two folders (node_modules & bower_components) are very heavy (300 mb and thousands of files) and it is very frustrating copy them using FTP.
Is there a way to keep only the needed files?
Thanks a lot
You can use gulp for creating bundle from the libraries into single file ex. vendor.js. Also deploying via ftp is very primitive. You should put your app on GitHub or Bitbucket and then log in to the server and pull your repository there and because you don't put the libraries folders into your git repository you will install the libraries on the server. If you want to go more advance you can use tool like Jenkins combined with gulp task for building your application. Jenkins will build your application automatically and deploy to your server on every push on your git repository
The following question could help you if you want to use Gulp:
How do I actually deploy an Angular 2 + Typescript + systemjs app?
Note that some answers are for beta versions and packaging changed for RC versions.
Angular-cli could also help you to build your application within the following command:
ng build -prod
Moreover using tree shaking could be interesting to minimize the weight of JavaScript files. See this article for more details:
http://blog.mgechev.com/2016/06/26/tree-shaking-angular2-production-build-rollup-javascript/
I moved my web project to another directory. I reopened it through NetBeans from the new directory. Running it resulted in the following error:
Created dir: C:\Users\Arthur\Desktop\projectSourceCode\arthurProj\build\generated\src
org.apache.jasper.JasperException: PWC6149: The -uriroot option must specify a pre-existing directory
C:\Users\Arthur\Desktop\projectSourceCode\arthurProj\nbproject\build-impl.xml:936: Java returned: 1
BUILD FAILED (total time: 1 second)
Should I change something in the build-impl.xml file before moving the project folder? I tried "clean and build" but the same error appears. How do I "specify a pre-existing directory"?
The build-impl.xml file: http://pastebin.com/PFv2aAjh
Goto your project folder and delete build and dist folders manually.
For example, if your project path like this C:\WebProject\build\ and C:\WebProject\dist, so delete these 2 folders. Now try clean and bulid project, this will create a fresh build and dist directories.
I was using ANT before (Android Project) and i had "static" files in the same packages as my code
Here is an example
src/com/my/app/test/Parser.java
src/com/my/app/test/json_to_parse.json
When executing the unit tests, the json file was copied into the gen folder, therfor it was possible to access the json in the test with
getClass().getResourceAsStream(fileName)
I had to convert the project to gradle, but now the tests are failing.
After checking the "build" folder, i've realised, the .json files are not there, therefor the getResourceAsStream method returns null.
Any idea how to include these "static" files (json, xml, ...) into the build folder?
Moving the files into the resources folder did not work out of the box in Android Studio (even though is should have)
This should be fixed in Android Studio 1.2.
However, this is what i did:
Moved all static files into the resources folder.
In my unit-test module i've added this to the build.gradle file
task copyTestResources(type: Copy) {
from "${projectDir}/src/test/resources"
into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources
Now, all files located inside src/test/resources will be copied into /classes/test where i can access them with
getClass().getResourceAsStream(fileName)
If i keep the package structure inside the resources folder the same as it was in the java folder, i don't need to adjust any code.
To complete the story a bit more:
JUnit4 runner requires
getClass().getResourceAsStream(name)
while Robolectric requires
getClass().getClassLoader().getResourceAsStream(name)
The files you are asking about are called "resource files" in Maven/Gradle lingo.
Gradle assumes that you are using the Maven Standard Directory Layout.
So, either you move your files into src/test/resources (then Gradle will pick them up automatically), or you tell Gradle that it should look for resources in some other place.
In the latter case, you need to modify the processTestResources task. However, keeping resource files in the same directory as source code is a bad practice. So I advise the former option.
if your problem is happen when you create apk with AndroidStudio.
you can create a jar file that includes your resources with jar.exe
for example i put a.txt into resources directory
and run this code in cmd:
"C:\Program Files\Java\jdk1.7.0_79\bin\jar" cvfe res.jar -c resources
after that a jar file "res.jar" was created
then add that res.jar into libs folder in your project
when your apk is creating resources are added to your final apk and you can use this code to acsess a.txt:
someclass.class.getClassLoader().getResourceAsStream("resources/a.txt");
with this job no need to change Gradle setting.