B
B
bozilly2015-10-09 10:31:13
Grunt.js
bozilly, 2015-10-09 10:31:13

How to get filename in Grunt?

There is such a piece of config

build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js'
      }

How to make Grunt get all js files and save them with the same names, just adding a suffix?
The brains were just enough for this
build: {
        src: 'src/*.js',
        dest: 'build/<%= pkg.name %>.min.js'
      }

What next? If you poke in the right place in the documentation, I will also be glad :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2015-10-10
@alexeyfedotof

Can be done with grunt-contrib-copy

copy: {
  dist: {
    files: [{
      expand: true,
      dot: true,
      cwd: 'dist',
      dest: 'dist/',
      src: [
        '{,*/}*.html'
      ],
      rename: function(dest, src) {
        return dest + src.replace('.html','.php');
      }
    }]
  }
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question