Variable names in Grunt folders for WebP - gruntjs

I'd like to convert all my images to WebP so I can optionally show WebP with a fallback. Here is the grunt for it: https://github.com/somerandomdude/grunt-webp
But I have a solid folder structure for my images so they are easy to find and for maintenance.
images/slider/
images/header/
images/people/
stuff like that. Is there a way to add a variable to src/dest so that the dest will retain it's folder structure?

Related

How to change polylang flag?

I need different flag for languages.
It is possible to use your own images as flags. You have to use PNG or JPG files and name them with the WordPress locale. For example, en_GB.png. Then upload this file in the /wp-content/polylang/ directory (create the directory if it does not exist). Don’t use the /polylang/flags/ directory as your file would be removed when automatically updating the plugin.
Once the custom flag is uploaded, go in Languages > Settings > URL modifications module then click on save changes. Note that your custom flags are not used on admin side.
I did all of this but the language switcher have the same flags... I don't see how the plugin would recognize that if I place an en_GB.png file in its directory (Not the flags folder). Feels like they miss something important, how to assign the images to certain language...
I modify flags, with CSS using title attribute, example:
img[title="English"] {
width: 50px !important;
height: 30px !important;
}
You have to go ssh/ftp (or any other way) to add a folder under /wp-content.
Your structure will look like:
> uploads
> themes
> polylang (this is your new folder)
> plugins
> languages
> index.php
Then create a PNG (preferably) or JPEG image for your flag (16x16px dimensions are good enough) and name it accordingly. For example for English you have to name the file as en_US.png (you can find the codes inside your plugin for each language).
Upload your image under /wp-content/polylang directory and go to your WordPress administration panel under Languages > Settings > URL modifications (just open this and hit save).
Refresh your browser and get your results!
Yes. You can use PNG, JPG or even SVG files and name them with the WordPress locale. For example, en_US.png.
Upload these files in the /wp-content/polylang/ directory.
Note: You have to create the directory yourself. Don’t use the /polylang/flags/ directory as your files would be removed when automatically updating the plugin. Alternatively, it’s possible to store the files in the /polylang/ subdirectory of the theme or the child theme.
Once the custom flags are uploaded, go to Languages > Settings. Click on the “URL modifications” settings and then on Save Changes.

Is there a way to verify if some CSS files are compiled from a certain LESS file?

I have a variety of CSS files and some LESS files. The CSS files have different prefixes and suffixes that the LESS files don't, so I can't know with certainity if a CSS file is derivated from certain LESS file just for the names of the files.
I was wondering if there is a tool, plugin, extension, method, way or similar to check a CSS against a LESS file and determine if the CSS file was compiled from the LESS given file and, if possible, to what degree.

asset_path rails helper using only the dns of assethost given

Hi following is the how the asset-host is defined.
config.action_controller.asset_host = 'cdn.com/site1'
Scss file example:
.home-ntf-headline.ntf-img {
background-image: url(asset_path('ntf-logo.png'));
}
The actual url frame for above Scss is cdn.com/assets/ntf-logo-b1a1fa585e8393a621c8ac16d515d96560d469afd8b9aadb36dc290acc4e9c42.png.
But what i actually expects
cdn.com/site1/assets/ntf-logo-b1a1fa585e8393a621c8ac16d515d96560d469afd8b9aadb36dc290acc4e9c42.png.
The static assets in request life cycle(i.e css, js, images) are framed correctly.
The "host" here is limited to the top level host, rather than a prefix to the full asset path. If you specify anything after cdn.com then it will be stripped before being applied as the asset_host in Actionview Helpers.
If you're looking to have multiple sites on the same CDN then you're going to have to look at subdomains rather than paths, or some kind of per-site unique naming convention for your assets (I'd advise against that).

Is it possible to .gitignore only certain .css files that are build products of neighboring .less/.scss files?

I'm working on a Create-React-App project, which notoriously does not support css transpilers such as SASS and Less. The general solution, as discussed here and here, is to compile the source .less/.scss and import the build product .css into your components. Then you can remove all .css from source control and only track .less/.scss.
This is a fine solution, but only a handful of my components really need Less for clarity/extensibility; for the most part, pure css is fine. So, what I'd like to do is use .css everywhere except for some .less sprinkled in here and there. I can configure this with the Less compiler, but for source control I'd like to watch only the "source" css files, and ignore the "build" css files (generated from Less). Because of this I cannot blanket .gitignore all .css, since some are truly source files.
So, is there a glob pattern for this? Maybe:
*.css where *.less
I see two other possible solutions:
switch everything to .less, even when it's not necessary, and go on ignoring all *.css
selectively .gitignore only the .css that are build products.
I like option 2, but it just seems a little error prone and more maintenance.
Switch everything to less is the verter choice: only one why to make css. It is also easiest to understand how project works for a colleague.
You should also keep different css folders for generated and non generated css file. Then, you can just ignore folder with generated.
You could get 2 folders for exemple src and dist
Simply put source .css and .less files in the src folder and when compiling this folder, copy the .css files to the dist one while .less files are compiled.
But I prefer your "all .less" approach which is less confusing for other developpers.

Exclude css files by default when checking in

I am using Less in Visual Studio to generate css files. When I check in I only want to check in the less files and exclude the generated css files. Is it possible to exclude css files by default when checking in?
Thanks!
If you are using Local Workspaces, you should be able to use a .tfignore file to ignore the css files like so:
######################################
# Ignore .css files in this folder and all its sub-folders
*.css
If you are using Server Workspaces, I think you will just have to avoid adding them when you use the Add Files to Source Control dialog. You can sort by the file type and select all the css files and choose "Exclude"

Resources