How to preserve comments with YUI compressor - yui-compressor

I'm using the YUI compressor to merge and minify my JS-files.
One problem I'm having is that comments are being deleted, even though I'm using the suggested format as follows:
/*!
comments go here
*/
That's what they say in the documentation and on several blogs:
http://www.julienlecomte.net/yuicompressor/README
http://www.electrictoolbox.com/preserve-comments-yui-compressor/
Any ideas on what can be wrong?

I re-ran YUI compressor and now all comments are in place. Probably my own fault...

Related

Add index to TOC with doxygen

I am using doxygen to create documentation (a PDF) for a C project. I would like the index to show up in the TOC. This is simple enough with [pdf]latex.
Problem #1: I cannot use the tocbibind or idxlayout packages (see link above). If I attempt to use these with doxygen
EXTRA_PACKAGES = [nottoc]tocbibind
then doxygen writes to the TeX source file
\usepackage{[nottoc]{tocbibind}}
and the extra {} causes a LaTeX error. This seems to be a bug in doxygen?
Problem #2: This leaves me with the imakeidx package (again, see link above). In the doxygen config file
EXTRA_PACKAGES = imakeidx
But now I need to change from \makeindex to \makeindex[intoc].
Back to the Doxyfile:
MAKEINDEX_CMD_NAME = makeindex[intoc]
But this has no discernible effect. Any suggestions for actually getting the index to show up in the TOC?
The issue as described occurred in Doxygen 1.6.1. Problem #1 above has been fixed (see here). In Doxygen 1.8.7 (which I am now using) the index is included in the TOC without issue.
UPDATE: Problem #2 was based upon my own misunderstanding of a configuration option. See the comment from albert, who has proposed a patch that provides the functionality I wanted.
EDIT: The mentioned pull request 715 has been integrated in master on github.

Workflow / best practices for XLIFF

I am using a command line tool (ng-xi18n) to extract the i18n strings from an angular 2 app I wrote. The output of this command is a messages.xlf file. Coming from a .po background, and being not familiar with .xlf, I assumed that this file is the equivalent to the .pot file (correct me if I am wrong).
I then assumed that if I want to translate my app, I had to cp messages.xlf messages.de.xlf to have a copy (messages.de.xlf) of the template file (messages.xlf) where I can translate each message into German (hence the .de.xlf).
After translating some dummy texts and running the app, I saw that it worked as expected, so I quit translating and continued developing the app. After some time, I added more i18n strings, and eventually thought that I had to update my template. And this is where things got hardly maintainable. I updated the template messages.xlf file, and quickly was wondering how I could update the new strings to my already translated messages.de.xlf file without loosing my progress.
When I was developing using .po files, this was no problem thanks to good tools like poEdit, but I didn't find anything comparable for .xlf. After trying some tools, I thought that the best choice would be Lokalize, but I didn't find a possibility to merge the template file to already translated (but outdated) files either.
Up to now, this was rather an essay than a question, so here's a quick summary:
Is the workflow of dealing with .xlf files really comparable to .po as I initially thought (described above), or is it completely different?
How am I suppose to update my already translated files?
What are the best practices dealing with .xlf files?
What are proof of concept tools to work with .xlf?
Sidenotes:
The Lokalize handbook was not helpful at all. I see a lot of functions that sound promising, like:
"File" > "Update file from template". I did not find anything in the handbook to explain this function. If I click on this, nothing happens.
"Sync" > "Open file for sync/merge". This seems to be a function to merge two similar files (by multiple translators) rather than a tool to update the translation file from a template. Even though there is a tooltip in Lokalize's primary sync tab, notifying me about "x unmatched entries", I just couldn't find anything to append those unmatched entries to my .de.xlf file.
[Update] Turns out, I had similar issues as in this question. After downgrading my version of Lokalize to the suggested one, many issues (including the ones mentioned in the question) disappeared. However, now the "Update file from template" option is greyed out, and I don't know why.
I also tried OmegaT, which does not work at all on my platform (Ubuntu 16.04).
[Update] Virtaal works great for merging new strings from a template, but the UI in general is very poorly designed...
Googling did not help, as every hit seems to be related to XCode or something.
Thanks for any help in advance, I really appreciate it
I wrote a small npm command line tool called xliffmerge.
In principle it does the same, that Roland Oldengarm does with his gulp tasks described in his blog article.
It is free and you can have a look at it at https://github.com/martinroob/ngx-i18nsupport#readme
The best workflow automation solution I have seen described so far is from Roland Oldengarm's blog entry "Angular 2: Automated i18n workflow using gulp". To summarize, in a few dozen lines of Gulp code he created the tooling to handle some of the challenges you faced. Specifically it runs ng-xi18n to extract the messages; creates an English translation with sources copied to targets; updates existing translations by adding new trans-units, keeping existing ones, and removing missing ones; and then exposes all xlf files as TypeScript string constants. These last strings can then be imported to supply the bootstrapModule with its translation provider options.
Caveat: I have not used this exact solution (and code) myself, but I was able to expose generated xlf as TypeScript strings and use them in an app in a manner similar to what he described. As for maintaining translations, I have leveraged IntelliJ IDEA (WebStorm) file comparison features and Counterparts Lite (for Mac) for that. My own efforts are still in early stages but are working end to end for an application that is in active development.
Official Angular docs are now updated for Internationalization (i18n) at https://angular.io/docs/ts/latest/cookbook/i18n.html including a section specifically for creating a translation source file with the ng-xi18n tool.

Difference between uncss and purifycss

I'm already using uncss with grunt, but stumbled upon purifycss.
I can't seem to find comparisons anywhere.
Can anyone tell me the difference between the two to help me choose the right one?
UnCSS removes unused CSS from your stylesheets.
PurifyCSS does not modify the original CSS files.
I use PurifyCSS and I full recommend.
I hope that simplify the things for you, everyone has a way to do the things. If I were you I would test both and see which one is more helpful for you.
EDIT:
PurifyCSS takes also care about JS-Files which could add CSS classes and IDs.
Here is a more recent comparison, courtesy of another similar project, purgecss: https://www.purgecss.com/comparison.html
Summary
PurifyCSS
Works with any file type, not just HTML or JS
Uses extractors, which takes the content of a file and extracts the list of CSS selectors used in it
UnCSS
Effective at removing unused selectors from web apps due to HTML emulation and JS execution.
This has a performance cost.
Most accurate tool if you don't use server-side rendering.
No extractor for JS files, but developers can create extractors for specific frameworks and file types.

Xcode - Document Based Application (Document Bundle)

I'm trying to find a somewhat more comprehensive writeup, or an example to refer to regarding a Document Based Application which saves it's contents to a document bundle rather than a single file.
A good example of what I mean by a document bundle is how Pages saves it's documents i.e.
Document Name.myextension\
directory1\
somefile.ext
somefile2.ext
directory2\
directory3\
file1.png
file2.png
As we know apples documentation, although extensive, can, at the best of times be somewhat daunting to work with :-/
Any help would be appreciated!
Thanks
Ade
Take a look at the following Stack Overflow question:
NSDocument to hold a complete folder?
If the answer to that question isn't detailed enough, you can read the following article on file packages:
Working with Cocoa File Packages
Regarding Apple's documentation, the relevant classes to look at are NSFileWrapper, NSData, and NSDocument.

Where is it best to edit CSS using twitter-bootstrap

I am currently trying to get to grips with bootstrap and am struggling to understand where I should be editing the CSS. I created a custom.css.scss file to edit settings in my app/assets/stylesheets folder however when I add rules they often seem to be overridden as such I have found that I have to edit certain elements by going to the external libraries bootstrap-sass resource and drilling down to the ../stylesheets/bootstrap folder where I then have to hunt for the relevant style to change. I am sure I am doing this the wrong way, is there something I should be doing to ensure my custom.css.scss has priority? Any help much appreciated!
You don't want to edit the bootstrap files themselves, but CSS rules have a precedence structure which determines which CSS rules are used. It is not terribly complicated, but is a bit tricky until you get the hang of it.
Smashing Magazine has a relatively good introduction to it with links to other sources as well.
In the application.css found in the assets all other styles are included you just need to change the order of these like mentioned here: Rails 3.1 Load css in particular order.