YUI Compressor to compress all the files in a directory - yui-compressor

I have a js folder that contains n number of javascript files (I might add/remove some files from that folder)
can I do something like that?
java -jar yuicompressor.jar dev/js/* -o dev/js/main.min.js
I want to merge all the files in that directory into a minified main.min.js but the command is not working. (if I put a file name instead of the * it works)

Related

force ANTLR to generate the output files in a specific folder

I don't like to have the ANTLR generated files in the same location as my .g4 grammar and other version-controlled documents. I would like to put all the generated files in a separate nested folder that can be excluded via .gitignore. What I have tried so far is to create a folder <someFolder> inside the main folder and from inside that folder ran:
cd <someFolder>
antlr ../<grammarFile.g4>
however, it still spills all the generated files in the parent folder.
P.S. It shouldn't matter but my environment is macOS.
From https://github.com/antlr/antlr4/blob/master/doc/tool-options.md:
-o outdir
ANTLR generates output files in the current directory by default. This option specifies the output directory where ANTLR should generate parsers, listeners, visitors, and tokens files.
in the example above, from the main folder run
antlr <grammarFile.g4> -o <someFolder>

Xcode Build path and copying additional files

I'm writing a plugin for Elgato Stream Deck. https://developer.elgato.com/documentation/stream-deck/sdk/overview/
Basically it is a binary command line tool written in C++/OBJ-C/Swift combined with a JSON manifest and optionally some HTML and JS files as well as different assets (.png, ...). All files have to be included in a folder (com.companyname.pluginname.sdPlugin) which lives in Library/Application Support/com.elgato.StreamDeck/Plugins/
At the moment, I'm building the binary to the default build path (derived data, ...) and manually copy it to the above folder. But I need to build and run that binary with an executable (Stream Deck app) defined in the scheme for debugging under Xcode. The JSON manifest and assets also lives in my xcode project folder and have to be copied manually.
So Before:
After:
So my question: how can I automate that under Xcode? I assume I can do some sort of post build scripting, but I have no knowledge about all that stuff.
Thanks
Solution:
go to target -> build settings
Deployment Location = YES
Installation Build Products Location = / (empty this one!)
Installation Directory = path to folder (= $INSTALL_PATH)
this will copy your binary to the defined installation path
go to target -> build phases
new phase -> run script
cp -r "$SRCROOT"/<FILE OR FOLDER NAME> "$INSTALL_PATH"/<FILE OR FOLDER NAME>
repeat this for all files and folders you need to be copied to the installation path. be careful with empty spaces in the folder/file names, they won't be recognized correctly and you have to use quotation marks

lessc Option --source-map-rootpath seems not to work

I use lessc 2.7.3. I generate css files via a makefile and use following paths
the makefile is in themes/bodensee
the css is generated in themes/bodensee/css
the less files are in themes/bodensee/less
the maps are in the same folder as the css files.
My problem is that css files misses the themes/bodensee path, so it raises a file not found on css.map files.
lessc -s less/wlb.less --clean-css="--s0 --advanced" --source-map-rootpath=themes/bodensee/ --source-map="css/wlb.css.map" css/wlb.css
The CSS file now contains `sourceMappingURL=css/wlb.css.map``The rootpath does not have any effect.
I also tried a fantasy rootpath and searched for it in the file - it does not appear anywhere. But the option is correct. When I try to missspell the option, LESS drops an error.
What am I missing?
Description of the --source-map-rootpath option from here
Specifies a rootpath that should be prepended to each of the less file paths inside the sourcemap and also to the path to the map file specified in your output css.
Because the basepath defaults to the directory of the input less file, the rootpath defaults to the path from the sourcemap output file to the base directory of the input less file.
Use this option if for instance you have a css file generated in the root on your web server but have your source less/css/map files in a different folder. So for the option above you might have
The problem was indeed related to the Clean-CSS plugin.
I now call
lessc --source-map --clean-css="--s0 --advanced" -s less/wlb.less css/wlb.css which is working.
There is a standalone clean-css program, but that does not generate sources for the Less files. It's not clear if the lessc plugin and the standalone tool are the same or different implementations but both use node.
The standalone cleancss tool removes the source map URL generated by lessc be default (did not play around with the dozens of options).
These Node tools develop very fast and manual/tutorials often are outdated. That's why my make file stopped working. Developers of that tools should really consider not to touch working parameters or features and to keep their code compatible.

How to cp a file only if it isn't already the same?

I have a build step in my static site generator that copies things like the favicon, and manifest, but it seems wasteful, since these files rarely change.
How can I change that build step so that it only does the cp if the files differ?
My npm script currently: "build-robots": "cp robots.txt _build/robots.txt",
Also, it would be great to do the same for directories of files. Like the /scripts directory which is full of js files and folders of js files (one for polyfills for example).
Using cp -ru folder/ _build/ works but it doesn't copy over deletes or renames. Any way to copy deletes and renames?

YUI Compressor - compress from one directory to another

I am on Win 7 and I want to compress my js/css files with YUI Compressor.
It uses require.js so I would like to keep the file names and folder structure same, before and after the compress.
I put the original js files into oldjs/ folder and want minified js files to be outputted into js/ folder.
Is there any way to do that?