Mean.js: why is Gulp overwriting changes to production.js - meanjs

Starting my Mean.js application using gulp prod is overwriting my changes to production.js. I edit the file, save it, commit it, whatever, and when I run gulp prod it immediately reverts to the state it was before I edited, linting errors and all. This is config/assets/production.js, which as far as I know is a source file, not something I'd expect to be generated.
I've searched the docs and the code to try to figure out what's happening, but I'm not getting it. Any hints?

This had been due to the 'wiredep' task overwriting the assets based on bower.json.

Related

htmlToImage Chrome 64 SecurityError: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

The new Chrome 64 security update seems to have broken the htmlToImage libraries. None of the styling is correctly calculated and is rendered as if no styling was applied at all.
Does anyone know of a workaround / fix? Do I need to put my CSS on the server and allow CORS?
I just fixed this error.
Forked the lib and made a pull request. Until it gets merged, you can use the forked repo: https://github.com/kmap-io/html-to-image
by replacing the target of html-to-image in your package.json with:
"html-to-image": "git+https://github.com/kmap-io/html-to-image.git"
About the bug
Chrome is complaining (throws an error) about trying to read a property that does not exist. Firefox also complains, but they only throw a warning, instead of an error. The fix consists of replacing
if (sheet.cssRules) {
...
with
if (sheet.hasOwnProperty('cssRules')) {
...
There is no downside (i.e.: when cssRules exists on sheet - which is a stylesheet - the script iterates through the rules and adds them to document, as supposed to).
How to patch (until it gets merged).
For some reason, simply replacing the library's repo with the fork in which I committed the change doesn't work for this package. I asked the lib's author to add instructions on how to build after a pull-request, as they state in the readme pull requests and contributions are welcome. Until then, here's how to apply the fix using patch-package:
add "prepare": "patch-package" inside scripts, in your project's package.json
npm i patch-package --save-dev
In node_modules/html-to-image/lib/embedWebFonts.js, change line 7 from
try {
to
if (sheet.hasOwnProperty('cssRules')) try {
npx patch-package html-to-image
If you have a deployment script that builds your project from scratch, you'll need to apply the patches right before you call npm run build (or similar, depending on your stack):
git apply --ignore-whitespace patches/*.patch
That's about it.
When the fix will be merged, you'll need to run:
npx patch-package html-to-image --reverse

PhpStorm - watchify connection bug

When I switched my editor to PhpStorm I found a bug working with watchify. By default watchify makes browserify to update a bundle if one of files using in a bundle is changed. Generally it works. But sometimes on a file nothing happens. On the next change a bundle is updated. And later this bug could happens againg - nothing is changed on a file change.
In Sublime Text, my previous editor, there was not this but. Everything worked as expected. And even now when I make changes in files a bundle was updated. So the issue is in how PhpStorm saves file.
I tried to check this with gulp-watch. I run watch on files and log a message on files change. In this case a message is logged on every change. I am not sure how watchify works. I considered watch changes with gulp-watch but I can not find how to delegate changes to watchify. So for now I must track if a bundle is updated and if it does not I have to make a unnecessary change (add and remove a space) for watchify to run it.
Should I update PhpStorm? Or you have any other ideas?
Might be an issue with hanndling safe writes... Please try turning 'Safe write' option ( Settings | Appearance & Behavior | System Settings | Use "safe write" (save changes to temporary file first)) off - does it make any difference?

How to stop mercurial from syncing an EXISTING project file

So the problem is that all developers need different settings for their local testing, but the settings file is part of the project (unlike the nbproject folder for example that we all ignore). I know about .htignore, but the filter only applies to files that are not part of the project.
If I forget the file, then this removes it from the "global" repository, where we have a "holder" version of the settings file.
Right now we just don't commit that file, but every now and then somebody forgets and pushes his own settings, which then are synced back to other developers and it's a constant pain. We just want to "automatically" not push that file. Is there a solution to this? Are we doing something wrong?
You could add a precommit hook that gives an error every time you try to commit this particular file.
To handle the case of developers that forget to setup such a hook, you can also add a serverside hook that will reject their push.

Gulp Watch seems to not working correctly. It sees the modifies, but doesn't build them

I've just downloaded the last release of semantic UI, everything seems to work fine, but when I launch
gulp watch
and try to change a file, here what happen:
[gulp] Modified: src/site/globals/site.variables
And nothing happen ( no rebuild ). What could the problem be?
I had the same issue. The problem is that there's a regex which creates the path to the proper files to modify and it fails.
What helped me:
Go to tasks/config/project/tasks.js
Replace theme: /.*\/themes\/.*?(?=\/)/mg to with theme: /.*\\themes\\.*?(?=\\)/mg
Run gulp watch again

Trying to compile libgdx to html, but it cant clear the assets

Having trouble compiling my libgdx project to html.
Looking at the log I think the problem is;
Copying resources from ../android/assets to war/
C:\TomsProjects\MeshExplorerV2\html\..\android\assets
C:\TomsProjects\MeshExplorerV2\html\assets
[ERROR] Generator 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundleGenerator' threw an exception while rebinding 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundle'
java.lang.RuntimeException: Couldn't clean target path 'war\assets'
Now it strikes me as slightly odd the second line; As there was no html\assets folder.
The assets folder was in html\war\assets, like the last line complains about.
However, after creating a empty assets folder in html, and manually deleting the contents of html\war\assets I still get the same error.
Theres also a "html\webapp" directory without any assets folder. Not sure if there should be one.
I have tried cleaning/rebuilding from eclipse, as well as randomly also trying Gradle>>Refresh All.
Additionally, the Java version runs just fine.
Any pointers, thanks :)
While not exactly reveling the route of the problem, I noticed it let me compile again as long as I restarted eclipse inbetween.
This infers some file-lock going on, possibly a server still running, allthough nothing but the gwt compile as triggered by me.
Still, restarting is a fine workaround for me as it only takes a minute or two.
ah
Pinned it down: Close your FTP program when compiling - at least CoreFTP was locking the directory. Closing it works every time now.
I had a similar issue where I was getting the following error
[ERROR] Generator 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundleGenerator' threw an exception while rebinding 'com.badlogic.gdx.backends.gwt.preloader.PreloaderBundle'
java.lang.RuntimeException: Couldn't clean target path 'war/assets'
All my files under the html/war/assets directory were read only, re-starting the IDE didn't help. To fix it I needed to change permissions chmod -R 777 html/war/assets (you probably dont need 777).