Use grunt-wp-assets
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,4 +6,4 @@ assets/css/main.css.map
|
|||||||
assets/css/*main*.css
|
assets/css/*main*.css
|
||||||
assets/js/*scripts*.js
|
assets/js/*scripts*.js
|
||||||
assets/js/vendor/modernizr.min.js
|
assets/js/vendor/modernizr.min.js
|
||||||
assets-manifest.json
|
assets/manifest.json
|
||||||
|
|||||||
30
Gruntfile.js
30
Gruntfile.js
@@ -105,15 +105,19 @@ module.exports = function(grunt) {
|
|||||||
parseFiles: true
|
parseFiles: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filerev: {
|
version: {
|
||||||
assets: {
|
default: {
|
||||||
src: ['assets/css/main.min.css', 'assets/js/scripts.min.js']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
filerev_assets: {
|
|
||||||
assets: {
|
|
||||||
options: {
|
options: {
|
||||||
dest: 'assets-manifest.json'
|
format: true,
|
||||||
|
length: 32,
|
||||||
|
manifest: 'assets/manifest.json',
|
||||||
|
querystring: {
|
||||||
|
style: 'roots_css',
|
||||||
|
script: 'roots_js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
files: {
|
||||||
|
'lib/scripts.php': 'assets/{css,js}/{main,scripts}.min.{css,js}'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -144,12 +148,6 @@ module.exports = function(grunt) {
|
|||||||
'*.php'
|
'*.php'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
clean: {
|
|
||||||
dist: [
|
|
||||||
'assets/css/main.min.*.css',
|
|
||||||
'assets/js/scripts.min.*.js'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -165,12 +163,10 @@ module.exports = function(grunt) {
|
|||||||
]);
|
]);
|
||||||
grunt.registerTask('build', [
|
grunt.registerTask('build', [
|
||||||
'jshint',
|
'jshint',
|
||||||
'clean',
|
|
||||||
'less:build',
|
'less:build',
|
||||||
'autoprefixer:build',
|
'autoprefixer:build',
|
||||||
'uglify',
|
'uglify',
|
||||||
'modernizr',
|
'modernizr',
|
||||||
'filerev',
|
'version'
|
||||||
'filerev_assets'
|
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ function roots_scripts() {
|
|||||||
* Read the asset names from assets-manifest.json
|
* Read the asset names from assets-manifest.json
|
||||||
*/
|
*/
|
||||||
if (!(WP_ENV === 'development')) {
|
if (!(WP_ENV === 'development')) {
|
||||||
$get_assets = file_get_contents(get_template_directory_uri() . '/assets-manifest.json');
|
$get_assets = file_get_contents(get_template_directory_uri() . '/assets/manifest.json');
|
||||||
$assets = json_decode($get_assets, true);
|
$assets = json_decode($get_assets, true);
|
||||||
$assets = array(
|
$assets = array(
|
||||||
'css' => '/' . $assets['assets/css/main.min.css'],
|
'css' => '/assets/css/main.min.css' . '?' . $assets['assets/css/main.min.css']['hash'],
|
||||||
'js' => '/' . $assets['assets/js/scripts.min.js'],
|
'js' => '/assets/js/scripts.min.js' . '?' . $assets['assets/js/scripts.min.js']['hash'],
|
||||||
'modernizr' => '/assets/js/vendor/modernizr.min.js',
|
'modernizr' => '/assets/js/vendor/modernizr.min.js',
|
||||||
'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'
|
'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,15 +26,13 @@
|
|||||||
"bower": "~1.2.8",
|
"bower": "~1.2.8",
|
||||||
"grunt": "~0.4.2",
|
"grunt": "~0.4.2",
|
||||||
"grunt-autoprefixer": "~0.7.2",
|
"grunt-autoprefixer": "~0.7.2",
|
||||||
"grunt-filerev": "~0.2.1",
|
|
||||||
"grunt-filerev-assets": "~0.3.0",
|
|
||||||
"grunt-contrib-clean": "~0.5.0",
|
|
||||||
"grunt-contrib-concat": "~0.3.0",
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
"grunt-contrib-jshint": "~0.6.4",
|
"grunt-contrib-jshint": "~0.6.4",
|
||||||
"grunt-contrib-less": "~0.8.1",
|
"grunt-contrib-less": "~0.8.1",
|
||||||
"grunt-contrib-uglify": "~0.2.4",
|
"grunt-contrib-uglify": "~0.2.4",
|
||||||
"grunt-contrib-watch": "~0.5.3",
|
"grunt-contrib-watch": "~0.5.3",
|
||||||
"grunt-modernizr": "~0.5.1",
|
"grunt-modernizr": "~0.5.1",
|
||||||
|
"grunt-wp-assets": "git://github.com/roots/grunt-wp-assets.git#master",
|
||||||
"load-grunt-tasks": "~0.3.0",
|
"load-grunt-tasks": "~0.3.0",
|
||||||
"time-grunt": "~0.3.1"
|
"time-grunt": "~0.3.1"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user