2014-07-15 2 views
0

Я добавляю ворчание к проекту и я создаю несколько файлов JS с помощью задачи CONCAT, но я хотел бы, чтобы высушить путь к файлу, а затем повторять статические/JS/...пути к файлам Осушитель с Грантом

concat: { 
libraries: { 
    src: ['static/js/jquery-ui-1.9.2.custom.min.js'], 
    dest: 'static/scripts/libraries.js' 
}, 
plugins: { 
    src: ['static/js/le-mtagconfig.js', 'static/js/jquery.magnific.js', 'static/js/jquery.tipTipTui.js', 'static/js/jquery.galleriffic.js', 'static/js/jquery.opacityrollover.js', 'static/js/jquery.bxslider.min.js' ], 
    dest: 'static/scripts/plugins.js' 
}, 
site_52: { 
    src: ['static/js/main.js', 'static/direct/js/main.js', 'static/js/52.js', 'static/direct/js/52.js' ], 
    dest: 'static/scripts/site_52.js' 
}, 
site_70: { 
    src: ['static/js/main.js', 'static/direct/js/main.js',, 'static/js/70.js', 'static/direct/js/70.js' ], 
    dest: 'static/scripts/site_70.js' 
}, 
site_71: { 
    src: ['static/js/main.js', 'static/direct/js/main.js', 'static/js/71.js', 'static/direct/js/71.js' ], 
    dest: 'static/scripts/site_71.js' 
}, 
site_78: { 
    src: ['static/js/main.js', 'static/direct/js/main.js', 'static/js/78.js', 'static/direct/js/78.js' ], 
    dest: 'static/scripts/site_78.js' 
}, 
site_79: { 
    src: ['static/js/main.js', 'static/direct/js/main.js', 'static/js/79.js', 'static/direct/js/79.js' ], 
    dest: 'static/scripts/site_79.js' 
}, 
site_81: { 
    src: ['static/js/main.js', 'static/direct/js/main.js', 'static/js/81.js', 'static/direct/js/81.js' ], 
    dest: 'static/scripts/site_81.js' 
}, 
custom: { 
    src: ['static/js/tripadvisor.js', 'static/js/tripadvisor-templates.js', 'static/js/handlebars-v1.3.0.js', 'static/js/handlebars-helpers.js', 'static/js/jquery.modals.js', 'static/js/jquery.bxslidertui.js' ], 
    dest: 'static/scripts/custom.js' 
} 
}, 

ответ

1

Просто используйте имя шаблона в стиле <%= varName =>.

Например:

module.exports = function (grunt) { 

    grunt.js = 'static/js/'; 
    grunt.directJs = 'static/direct/js/'; 

    concat: { 
    plugins: { 
     site_52: { 
     src: [<%= grunt.js %>main.js', <%= grunt.directJs %>main.js'] 
     } 
    } 
    } 
} 

 Смежные вопросы

  • Нет связанных вопросов^_^