A
A
Alexey2019-07-24 12:34:39
Node.js
Alexey, 2019-07-24 12:34:39

Grunt - can I use my own loops inside grunt-critical to iterate over some values?

I am using the grunt-critical plugin in a project.
It is necessary to generate more than 4 critical css files.
For this I use:

critical: {
      homepage: {
        options: {
          base: './',
          css: [
            'css/styles.css'
          ],
          width: 1200,
          height: 900
        },
        src: 'src/html/homepage.html',
        minify: true,
        dest: 'dist/homepage-critical.css'
      },
      category: {
        options: {
          base: './',
          css: [
            'css/styles.css'
          ],
          width: 1200,
          height: 900
        },
        src: 'src/html/category.html',
        minify: true,
        dest: 'dist/category-critical.css'
      },
      product: {
        options: {
          base: './',
          css: [
            'css/styles.css'
          ],
          width: 1200,
          height: 900
        },
        src: 'src/html/product.html',
        minify: true,
        dest: 'dist/product-critical.css'
      },
}

in the Terminal, I execute grunt criticaland run the tasks one by one: critical-->homepage, critical-->category...
TASK
These are the repeatable pieces of code that I am going to run in a loop, into which I will pass two arrays for dest and src. ['dest1', 'dest2', 'dest3'...] , ['src1', 'src2', 'src3'...]
I didn't find a solution in the grunt-critical documentation.
Can you please tell me if I can accomplish this task this way?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question