Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing constants in gruntjs
    text
    copied!<p>I am trying to write my first Grunt task to copy some files from my common libs folder, which is out of my project directory.</p> <ul> <li>Project Folder : <code>/home/user/projects/bottle</code></li> <li>Common Libs directory : <code>/home/user/projects/common</code></li> <li>Files' source are inside Common Libs directory at : <code>lib/general/static/js/</code></li> <li>Files' destination inside project folder : <code>lib</code></li> </ul> <p>I have a <code>properties.json</code> file with Common Libs directory path as shown below</p> <pre><code>{ "common_libs" : `/home/user/projects/common` } </code></pre> <p>Now what I already tried is :</p> <pre><code>module.exports = function(grunt) { var properties = grunt.file.readJSON('properties.json'), paths = { common_libs : properties.common_libs, common_libs_js : this.common_libs + "lib/general/static/js/" }; grunt.initConfig({ copy: { main: { files: [ { expand: true, flatten : true, src: [ paths.common_libs_js + "/*" ], dest: 'lib/', filter: 'isFile' } ] } } }); grunt.loadNpmTasks('grunt-contrib-copy'); }; </code></pre> <p>I am running grunt as follows <code>grunt copy</code></p> <p>With this no files are copied to the destination.</p> <p>Help me in this.</p> <p>Also I want to know </p> <ol> <li>How can I use Ant's property tag type constants in GruntJS? Because I am getting the base folder from properties.json and I need to copy many files from different folders under the base folder.</li> <li>Can we have these type of constants per task?</li> </ol> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload