IntelliJ, synchronize files after grunt build - javascript

I am using Grunt to compile our Javascript into a single file, app.js. I am using Grunt inside of intelliJ via the grunt window to fire off a watch that will compile on change.
When a change is made, the grunt task runs and the files are compiled. Next I blur intelliJ, to update the resources on the tomcat server and refresh the browser.
The change never makes it to the tomcat server because intellij doesn't catch that the files have been updated via grunt.
For example: I can make a change and then open the newly compiled app.js file and see the change has not been applied. If I update resources in the project explorer I see the change, and can update it on the tomcat server via frame deactivation.
Is there a way to keep intelliJ synchronized after a grunt build/task fired from a watch?

Turns out IntelliJ 14 has a bug with registered watch tasks in grunt.
When you run watch via a registered task IntelliJ won't synchronize the files after each run.
If you run watch directly everything should work as expected.
This functionality is fixed in the next version of IntelliJ.
You can follow my conversation on you track here
https://youtrack.jetbrains.com/issue/WEB-14876

Related

How to make sure javascript and css is cached in Angular app

I am reasonably new to angular (5), and have noticed that the javascript files (vendor.bundle, main.bundle, etc) are being reloaded each time I visit a page.
Is there anything in particular I should be doing to make sure that these are held in a browser cache after the first time they are loaded?
I guess I would need to add a cache-control header, but am not sure where to put it in the code, or whether this is something that the Angular-Cli could generate
Angular have lib called Service workers, which simply can be installed in cli project by below cli command
ng add #angular/pwa --project *project-name*
Note: project name can be obtained from angular.json
This command do the most required configuration but still some other stuff is needed, Which can be found on the flowing link service-worker confi. but some of this configuration already done by previous mentioned command. but also more configuration may be needed in "ngsw-config.json" file.
But unfortunately i tested this inside spring war and still the big files still downloaded every time without any caching but if i deployed on http server direct it work perfect.
Inside Spring War Result
For More Info. Please Check the blob of Angular Service Worker - Step-By-Step Guide for turning your Application into a PWA

Visual Studio Installer "Setup Project" Have a .js run after install and then another before uninstall?

I have this program where a server is made. Before the server can start though I need to register it. This is a one time thing as re-registering it will change all the dcom data and settings to factory settings. Which I don't want. So What I have set up is a JS file that runs my program and gives it a parameter argument "register" which is handled in my program to register the server. Similarly before uninstalling I want to run a similar JS file that passes an unregister argument so the server is no longer listed on client views after it's been removed. To be clear I have both of these JS files working fine and they successfully register/unregister my server as needed.
My issue is that I've added these files in the application directory and in my Visual studio installer: Setup Project, I have gone to right click installer project > view > custom actions. Then I right clicked the install folder and added my regserver.JS file and similarly for uninstall I've added my unregserver.JS file. The problem lays in the order that these get run. When the intaller runs it first run my regserver.JS. This is bad because there is no .exe of my program existing yet so an error is thrown... Is there a way to specify in my project that this JS is only to be executed AFTER the installation finishes?
Or is there a clever wrap around to this? Maybe I'm doing it all wrong!
EDIT: ..just an idea... what if I make ANOTHER two JS files that delay for like 30 seconds while the installer runs and then they execute my regserver/unregserver files... Really sloppy but I mean it might work...

Sails.js run asset pipeline on js file change

I understand when I run sails lift that the grunt tasks will run and put my assets in .tmp/. However, if I'm doing local development and want to make changes to some files in assets/js and refresh the page in the browser and see the updated code it seems I have to stop the server and re-lift the app.
I know there's a grunt watch task configured, and it seems like that is intended to handle this kind of thing. My questions are:
is the watch supposed to handle (for example) .js file changes and deliver the re-compilied/minified/concatenated/whatever'd scripts to .tmp/ without restarting the app?
if it is supposed to work like that, what common things should I check to troubleshoot why it's not?
As a side note, I'm running it with forever and simply ended up omitting **/assets/** from my .foreverignore file from what was listed in this answer. However, that still has the issue that the whole app is restarting when really I just need the asset pipeline run on change.
I disable Grunt during development and works fine for me.
This is how my .sailsrc looks:
"hooks":{
"grunt":false
},
"paths":{
"public":"assets"
}
Documentation:
http://sailsjs.org/documentation/concepts/assets/disabling-grunt

Grunt recompile since last run

I have grunt watch setup so when i`m developing my files are automatically compiled, but after I pull i need to "touch" the files in order to trigger recompile the new files in case watch was not running while I pulled, is there a generic way to make grunt track last edit for files without having to "touch" the new files or should i just have grunt watch running before I pull (which while writing this seems like an adequate solution)?
Just have the watch run while you make the pull, or just run the tasks manually--the kind of detailed tracking you're suggesting just seems like overkill to me. Keep it simple!

Share implementation files among Chrome (packaged) Apps?

I have several Chrome Apps that share various assets (CSS, JavaScript, and the like), but it seems that all of the constituent files are required to be in the app folder. I don't want to put these files on a server, because I want the app to be entirely self-contained. I tried OS X aliases, but the Chrome system didn't recognize them in <script> elements.
Obviously, I don't want to maintain multiple copies of these files, as some of them change often during development.
Any ideas short of writing a preprocessor that's run every time a file changes? It would use a file called something like files.json that lists the assets not already in the folder or one of its subfolders.
We currently have experimental support for "shared modules", where one extension or app can depend on a set of others. The dependencies just provide files which can be loaded in the apps/extensions that depend upon them ; they cannot have any permissions or features (like a background page) of their own. At install time for an app/extension that depends on shared modules, we will automatically download and install any missing dependencies from the chrome webstore, as well as remove them later if you uninstall all apps/extensions that depend on them.
Right now the feature is only available in the dev channel of chrome, but we intend to fully support it when we've had a chance to get developer feedback. If you want to try it out, grab a copy of the chrome dev channel (or canary).
In the manifest.json for an extension that is just a bundle of files you want to share:
{
...
"export": {
"resources": [ "foo.js", "bar.js" ]
},
...
}
In the manifest.json for an extension/app that wants to depend on the above:
{
...
"import": [{"id": "<id of dependency goes here>"}],
...
}
See the test data files in this codereview for more examples:
https://codereview.chromium.org/13971005
(Sorry we don't have good documentation for this yet ; we will eventually)
Give it a try and send some feedback to extensions-dev#chromium.org or apps-dev#chromium.org.
Normally such are done via package manager. You can use bower to add some local git dependency. Or if you simply want to copy files to your folder every time the target files have changed you can use Grunt task runner with Watch task.
When I said "writing a preprocessor" I overstated what would need to be done. jusio's solution I guess works, but I did something even simpler, with this script run from inside BBEdit:
#! /bin/sh
cd /Users/marc/Documents/Dropbox/dev/chrome
rsync -vrt lib NoteTree
open '/Applications/Chrome Apps.localized/Default nnlinebecgjceggljgcnfploamgnjjhl.app'
This copies the changed files and then invokes the Chrome App. If it's already running, which it usually is during development, I just right-click and choose Reload App. It's a very quick edit-and-test cycle.
(Explanation: /Users/marc/Documents/Dropbox/dev/chrome is the parent folder for my development, subfolder lib contains the common files, and NoteTree is the app I'm currently working on.)

Categories

Resources