forked from godaddy-wordpress/primer-child-stout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
118 lines (105 loc) · 2.2 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* global module, require */
module.exports = function( grunt ) {
var pkg = grunt.file.readJSON( 'package.json' );
grunt.initConfig({
pkg: pkg,
autoprefixer: {
options: {
browsers: [
'Android >= 2.1',
'Chrome >= 21',
'Edge >= 12',
'Explorer >= 7',
'Firefox >= 17',
'Opera >= 12.1',
'Safari >= 6.0'
],
cascade: false
},
dist: {
src: [ '*.css' ]
}
},
cssjanus: {
theme: {
options: {
swapLtrRtlInUrl: false
},
files: [
{
src: 'style.css',
dest: 'style-rtl.css'
},
{
src: 'editor-style.css',
dest: 'editor-style-rtl.css'
}
]
}
},
sass: {
options: {
precision: 5,
sourceMap: false
},
dist: {
files: [
{
'style.css': '.dev/sass/style.scss',
'editor-style.css': '.dev/sass/editor-style.scss'
}
]
}
},
watch: {
css: {
files: '.dev/sass/**/*.scss',
tasks: [ 'sass','autoprefixer','cssjanus' ]
}
},
replace: {
version_php: {
src: [
'**/*.php',
'.dev/**/*.scss'
],
overwrite: true,
replacements: [ {
from: /Version:(\s*?)[a-zA-Z0-9\.\-\+]+$/m,
to: 'Version:$1' + pkg.version
}, {
from: /@version(\s*?)[a-zA-Z0-9\.\-\+]+$/m,
to: '@version$1' + pkg.version
}, {
from: /@since(.*?)NEXT/mg,
to: '@since$1' + pkg.version
}, {
from: /VERSION(\s*?)=(\s*?['"])[a-zA-Z0-9\.\-\+]+/mg,
to: 'VERSION$1=$2' + pkg.version
}, {
from: /'PRIMER_CHILD_VERSION', '[a-zA-Z0-9\.\-\+]+'/mg,
to: '\'PRIMER_CHILD_VERSION\', \'' + pkg.version + '\''
}]
},
version_readme: {
src: 'readme.*',
overwrite: true,
replacements: [ {
from: /^(\*\*|)Stable tag:(\*\*|)(\s*?)[a-zA-Z0-9.-]+(\s*?)$/mi,
to: '$1Stable tag:$2$3<%= pkg.version %>$4'
} ]
},
pot:{
src: 'languages/' + pkg.name + '.pot',
overwrite: true,
replacements: [ {
from: 'charset=CHARSET',
to: 'charset=UTF-8'
} ]
}
}
});
require( 'matchdep' ).filterDev( 'grunt-*' ).forEach( grunt.loadNpmTasks );
grunt.registerTask( 'default', [ 'sass', 'autoprefixer', 'cssjanus' ] );
grunt.registerTask( 'version', [ 'replace' ] );
};