drupal-image-style-generator 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/index.js +2 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -50,5 +50,7 @@ gen({
50
50
 
51
51
  **gridSize**: (Default: 0) Number to which grid the images are rounded up. In the worst case, the image is gridSize - 1 px to big for the breakpoint, but a higher grid will result in lower individual image styles.
52
52
 
53
- **convertTo**: (Default: null) enables the image_convert style - allowed values are `png`, `jpg`, `jpeg`, `jpe`, `gif`, `webp`
53
+ **convertTo**: (Default: null) enables the image_convert style - allowed values are `png`, `jpg`, `jpeg`, `jpe`, `gif`, `webp`
54
+
55
+ **clearCropTypes**: (Default: null) If set to true, unused `crop.type.aspect_*.yml` files will be removed. This can cause a lot of trouble and require you to remove all existing crop definition entities. Should not be done in a live site.
54
56
 
package/index.js CHANGED
@@ -1,13 +1,9 @@
1
1
  const REQUIRED_OPTIONS = ['themePath', 'themeName', 'syncFolder'];
2
2
  const helpers = require('./src/helpers');
3
- const fs = require("fs");
4
3
  const path = require("path");
5
- const yaml = require("js-yaml");
6
- const log = require("fancy-log");
7
- const {v4} = require("uuid");
8
4
 
9
5
  /**
10
- * @param {{themePath: string, themeName: string, syncFolder: string, gridSize?: number, convertTo?: string}} options
6
+ * @param {{themePath: string, themeName: string, syncFolder: string, gridSize?: number, convertTo?: string, clearCropTypes?: boolean}} options
11
7
  * @returns {boolean}
12
8
  */
13
9
  module.exports = function (options) {
@@ -425,7 +421,7 @@ module.exports = function (options) {
425
421
  configFiles.forEach(file => {
426
422
  if (
427
423
  ((file.indexOf('image.style.sc_') === 0 || file.indexOf('image.style.s_') === 0 || file.indexOf('image.style.mc_') === 0) && !usedStyleConfigs[file]) ||
428
- (file.indexOf('crop.type.aspect_') === 0 && !usedCropTypes[file])
424
+ (options.clearCropTypes && file.indexOf('crop.type.aspect_') === 0 && !usedCropTypes[file])
429
425
  ) {
430
426
  fs.rmSync(`${syncFolder}/${file}`);
431
427
  console.log('%o is unused and was removed.', file);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drupal-image-style-generator",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A helper tool to automatically geenrate drupal 8+ responsive image styles",
5
5
  "main": "index.js",
6
6
  "scripts": {