Gulp - After versioning my images with "gulp-rev", how can I update their references in a CSS in a different location to the outputted image files? - node.js

Using Gulp and Node.js, I'm creating a proof of concept that generates sprites from folders of images, then versions the generated sprites so they have unique file names for cache busting purposes.
I'm using https://www.npmjs.com/package/gulp-rev to version the sprites (this works!), but I'm having trouble updating CSS files with references to the images. There are some tools that I have looked at for this purpose but I haven't been able to get them to work. The two that I have look at are:
https://github.com/jamesknelson/gulp-rev-replace
(Seems fully featured by can't figure it out)
and..
https://github.com/galkinrost/gulp-rev-css-url
(Got working but couldn't separate the destination for the revisioned images files and the updated CSS with the new images names)
Essentially I want to grab all the images from gulp-image-versioning-poc/images/sprites/*.png and then version them, put the resulting images in gulp-image-versioning-poc/dist/ and update the references to those images in gulp-image-versioning-poc/css/*.css
I've created a simplified example of what I currently have here:
https://github.com/olthof/gulp-image-versioning-poc
If anyone could help me tackling this problem I would be very grateful!!!

Related

How to redact texts in a pdf file in NodeJs

I am struggling to apply text redaction in a PDF file in a aws lambda function written in NodeJs. Here is a list of libraries that I have tried with no success:
pdf-lib: This library almost fulfils all the requirements except that it doesn't redact the text permanently as part of its limitations https://github.com/Hopding/pdf-lib/issues/827
PDF.js: To overcome the above limitation, tried to covert the pdf to an image, so the redaction black boxes are applied permanently. Example code here: https://github.com/mozilla/pdf.js/blob/master/examples/node/pdf2png/pdf2png.js However, this lib is not reliable as this cannot extract contents from most pdfs during the process.
Finally, Pdf2Pic: This library helps to overcome the limitation of the first library (pdf-lib) by the converting the pdf into images. But this library internally uses two non node based libraries (graphicsmagick and ghostscript) which I am trying to avoid.
Is there a nodejs based solution that can be used to apply redaction permanently on a pdf file or any solution that can be used to covert a pdf to images to overcome limitation of pdf-lib.

How to add dyamic assets in PKG

I'm trying to package an application which essentially takes a screenshot webpages using puppeteer which then stores it in a folder called report. However since the number of images changes vary I am unable to define this in the asset property of pkg. How do I go about this?
I've added an image of my package.json and the actual error
*Edit:
I've tried to use
report/*.* || report/*.png
but to no avail

How to change the size of the images through the magnolia cms imaging module

I have put the jar file inside the library of my magnolia(https://nexus.magnolia-cms.com/#nexus-search;classname~ImagingServlet), but when I invoke the url to return the cropped image, I get an error, if someone can help me.
[this is what appears to me1
I would guess that you are either missing the destinations folder or user has no access to it. Alternatively you are missing imaging support for DAM - see more at various additional jars you might need in documentation.
Also it seems you just copied thumbnail link from the admincentral, so perhaps you might want to read more on using themes and predefined image variations.

EmberJS in combination with Ember-Runner

Good day,
I just started with EmberJS in combination with Ember-Runner. I found an working example on Github.
Ember-runner automaticly adds all your template files and JS (at least that is what I thought) together and generarates a singe HTML / JS / templates / CSS file from your own files every time you save. (And optionally minify's and such). A build tool, just like it says in the description.
This is what it does for the CSS and templates part, however for the JS part it only seems to include only one file in my JS folder which is called 'main.js'. Is it possible to scan that dir for other files so it includes those as well? (So I can have separate controller / model files and such).
I hope my question is clear.
Kind regards,
Matthijn Dijkstra

SharePoint: Site Collection Images vs Images vs Style Library Images

Something I've been wondering. Is there a best practice or rule of thumb on how to store your images? I see 3 ways currently:
Site Collection Images
Images library
Style Library/Images
My rule of thumb has been: if you have only 1 site collection for your project, then use the Site Collection Images. Otherwise, create a folder structure like: /Style Library//images.
What is the difference between Site Collection images and the Images library?
Images lib provides a thumb view by default while the Style lib/images just treat images as files.
Site collection images? I think it's just another name of the Style lib/images of the top site.
Site Collection Images is a carry-over document library from the 2007 Publishing Feature. It's a document library but with multiple content types assigned to it (Image, Audio, Video). There's a thumbnail view associated with some of the content types so you get a nice preview of an image.
Images is a new library called and Asset library but in reality and behind the scenes, it's exactly the same as the old Site Collection Images document library with the three custom content types assigned to it. The only difference I can see is the icon used for the library.
Style Library is just a regular document library with no content types associated with it. It's created as part of the Publishing feature and pre-populated with some basic images, css files, and xsl style sheets (that are used with the DataView Web Part).
My standard (if you want to call it that is this).
A new folder for your site in the Style Library (sitename) with subfolders of "css", "js", and "img". The reason for this naming is that some libraries, plugins, and other addons will look for this type of structure (with CSS doing a relative path to an "img" folder to look for images). So it keeps things compact and identifable.
I choose to put CSS, JavaScript and Images here rather than creating separate libraries for it all. CSS is for (obviously) style sheets. JS is for javascript. This would include jquery (in the root js folder) or jQuery plugins (in a separate folder for each plugin). IMG is for CSS icons, system icons (e.g. twitter badges, etc.). I find this layout just handy and doesn't hurt anything keeping it all together.
I put regular photo content into Site Collection Images since a) it gets automatically populated when you create a publishing site or activate the feature and b) it's easy to find when inserting pictures into a rich content field. I'll just hide or tell the users to ignore the Images library (it can't be deleted because it's part of the Publishing Feature).
Hope that helps. YMMV.
I'd add that the style library is also different in that it's contents are readable by all users even if you have removed their permissions to the library or an item within the library.

Resources