generating certain assets in production after changes are made - Nuxt.js - assets

I store user uploaded images inside /assets directory, so I serve them using require() which takes an uploaded image built inside _nuxt directory.
Now these uploads can be uploaded by users through the form and in production after every upload made I need to build them manually through the command line since the assets are not built on changes as it is in development.
Is there a sollution to build certain assets (uploaded images) after changes are made in production?

Related

export and maintain vue application

I have developed a vue application and did run npm run build
After that I uploaded the content in the dist file to my webpage but it returned a blank page.
Since I did this for testing I uploaded it to a folder in my public_html/mypage.com/vueapplication To get all the paths right I added a vue.config.js with this content:
// vue.config.js
module.exports = {
publicPath: '/vueapplication/'
}
The application now works but I wounder however:
how do I best publish/upload the application to my site? Just by simply dragging the content inte the right folder?
how can I best maintain my site? Do I need to build again and upload, overwriting my files when everytime I make an update on my site?
And what is the difference between build and deploy your application?
Drag and dropping your code should work. But as your app grows you may want to look into automating this. For instance if you use an S3 bucket you can use the aws cli to automate the upload.
Yes, you should overwrite your deploy folder(s). You need to also take care of deploying different binary files, that have the same name. An example is if you have a global css file (main.css for instance). The file will probably change content between deployments, but keep the same name. Browsers may cache the file so users that downloaded older versions of the file will not use the new one. There are different techniques to handle this, but if you use webpack, it uses cache busting techniques and you should be fine.
Build is the process of transforming source code into an artifact(s). Exactly what this means differs from language to language, platform to platform. In the vuejs world this usually means a couple of js files, a couple of css files and some assets.
Deploying means taking the output of a build and making it available to your users. Again this differs from project to project. In the vuejs world this usually means taking the artifacts from the build and uploading them to an http enabled web server.

Shopify Use Subdirectory in Asset Folder

Instead of putting all files in a place in the asset folder, I want to use CSS files in CSS folder, JS files in js folder and images in images folder. Then Include them in the asset folder, so that I can maintain the files easily.
I know Shopify doesn't support any sub-directories within the asset folder. But is there any trick to do that?
According to a Shopify employee. This is currently not possible and the reason is due to a limitation of the CDN they use. See that post here.
Regardless, it's not good practice to have source files in the assets folder. Look into the Shopify Slate tool. It's a theme scaffold and command line interface that helps keep your project structure organized.
You can organize your assets (both CSS and JavaScript) as source files with directory structures in a manner similar to this:
styles/
global/
modules/
settings
tools/
vendor/
The command line tool takes care of compiling all the source files into one CSS/JS file! As a consequence, you don't need to worry about including the respective files with <link> or <script> tags because it's all taken care of already!
Unfortunately, this is not something currently supported by Shopify (As of 14/Sept/2017)
I tried making sub-folders both at the root of my dev theme and in the asset folder of my dev theme in a few different ways, including through Shopify's ThemeKit editor, but Shopify did not let me create the folder.
Attempting to create sub-folders in the normal theme editor in the store (by naming an asset subfolder/filename) generates the error message: Theme files may not be stored in subfolders
Shopify's normal theme editor groups files by types so that they appear close together, and apparently that's as much as Shopify is giving us right now.

Require locally packaged assets in remotely downloaded js bundle

I used this solution to download js bundle each time my app starts because I want an easy way to deploy minor changes during development stage.
The downloaded file is the one I exract from built apk. However, no images required in js (like require('../grapic/pic.png')) show up when application is run in this mode.
I save the js file like this:
File jsCodeDir = getApplicationContext().getDir("assets", Context.MODE_PRIVATE);
File f = new File(jsCodeDir, "remote.android.jsbundle");
// ... download file and put it into f
It seems that the problem is with paths: js isn't able to require images when it is stored in assets/ folder of internal storage, as opposed to when it is run from default assets/ folder from within apk.
So the question: is there a way to make a bundle such that it is able to use locally packaged resources (images from within apk just like locally packaged js does).

can't access uploaded files in dist mode in play framework

I have done all mandatory / required steps to run the project in 'dist' mode,though it is running perfectly,i can't access the files which i've uploaded in the same.
i can see the uploaded files,in 'my_project\bin\public' folder but not able to download it.
being newbie in play framework i would like to facilitate the users who have uploaded their files in the system to download the same.

rails 3.0.1 dynamic asset generation pre/post capistrano deployment

I am running rails 3.0.1, and while we intend to move to 3.1 and the asset pipeline I am looking for solutions/workarounds for asset generation during unicorn hot restarts.
Essentially what happens currently is we deploy to our site and when the deploy is complete the "current" symlink is changed to the new directory which does not have the static assets yet. Then approximately 60 seconds later all assets are generated and all is well, but for the 60 seconds before the assets are generated our site is basically down.
Questions:
If I copy the files from the old release dir, to the new dir will the asset generation overwrite the older files I've copied?
Where in the rails code is the asset generation done? ActionPack Dispatcher?
Is the generation of these assets done upon initialization of the app or at another stage?
If you layout is something like this:
/srv/yourapplication/current
You should have a shared folder
/srv/yourapplication/shared/assets
and symlink public/assets to /srv/yourapplication/shared/assets
This way each time your old assets and new assets will all be in the same folder and will be served properly.