Skip to content

Instantly share code, notes, and snippets.

@zamber
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamber/9969919 to your computer and use it in GitHub Desktop.
Save zamber/9969919 to your computer and use it in GitHub Desktop.
/* jshint undef: true, unused: true */
/* global module */
module.exports = function(grunt) {
require('time-grunt')(grunt);
grunt.initConfig({ // task definitions below
// Compile LESS to css.
less: {
test: {
files: [
{
src: 'main.less',
dest: 'compiled.css'
}
]
}
},
replace: {
test: {
overwrite: true,
options: {
patterns: [
{
match: '../src1',
replacement: 'string replaced!'
},
{
match: '../src2',
replacement: 'string replaced!'
}
],
force: true,
usePrefix: false
},
files: {
'compiled.css': 'compiled.css'
}
}
}
});
/*
Leaving all dependencies to track down possible conflicts
*/
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-fileindex');
grunt.loadNpmTasks('assemble-less');
grunt.loadNpmTasks('grunt-ssh');
grunt.loadNpmTasks('grunt-concurrent');
// *** DEFAULT ***
grunt.registerTask(
'default', [
'test'
]
);
grunt.registerTask(
'test', [
'less:test',
'replace:test'
]
);
};
/* src1 */
@import (less) "src1.less";
/* src2 */
@import (less) "src2.less";
.main {
background-image: url(../dummy.png);
}
{
"name": "grunt-replace-test",
"description": "A test case for grunt-replace",
"author": "Piotr Zaborowski <zamber88@gmail.com>",
"repository": {
"type": "git",
"url": "https://gist.github.com/9969919.git"
},
"devDependencies": {
"nunjucks": "~0.1.10",
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-watch": "~0.4.4",
"assemble-less": "~0.6.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "0.6.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-text-replace": "~0.3.6",
"grunt-fileindex": "~0.1.0",
"grunt-ssh": "~0.6.3",
"grunt-concurrent": "~0.4.2",
"time-grunt": "~0.2.5",
"grunt-contrib-concat": "~0.3.0",
"grunt-replace": "~0.7.6"
},
"engine": "node >= 0.10.0"
}
.src1 {
background-image: url('../src1/dummy.png');
}
.src2 {
background-image: url(../src2/dummy.png);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment