Skip to content

Commit

Permalink
Add css minfying & convert fontello css classes into variables.
Browse files Browse the repository at this point in the history
Instead of having a duplicate list of what build tasks to call. Lets have a dev list which has everything we need and reference it from the main build list.
  • Loading branch information
spAnser committed Nov 1, 2016
1 parent 4051ba2 commit f4dc843
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
6 changes: 2 additions & 4 deletions root/Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ module.exports = (grunt) ->

grunt.registerTask 'install', ['bower_install', 'craft_install']
grunt.registerTask 'craft-update', ['clean:craftPreUpdate', 'install']
grunt.registerTask 'compile_styles', ['sass', 'bless', 'criticalcss']
grunt.registerTask 'compile_styles-dev', ['sass']
grunt.registerTask 'build', ['install', 'clean:main', 'mkdir', 'fontello:dist', 'copy:main', 'copy:craft_plugins', 'copy:craft', 'compile_styles', 'bower_concat', 'uglify', 'copy:css']
grunt.registerTask 'build-dev', ['install', 'clean:main', 'mkdir', 'fontello:dist', 'copy:main', 'copy:craft_plugins', 'copy:craft', 'compile_styles-dev', 'bower_concat', 'copy:css']
grunt.registerTask 'build', ['build-dev', 'uglify', 'criticalcss', 'cssmin']
grunt.registerTask 'build-dev', ['install', 'clean:main', 'mkdir', 'fontello:dist', 'regex-replace:fontello', 'copy:main', 'copy:craft_plugins', 'copy:craft', 'sass', 'bower_concat', 'copy:css']
grunt.registerTask 'default', ['build-dev', 'watch']
9 changes: 9 additions & 0 deletions root/grunt/cssmin.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = (grunt) ->
grunt.config 'cssmin',
options:
sourceMap: true
files:
expand: true
cwd: 'dist/public/assets/styles'
src: ['**/*.css']
dest:'dist/public/assets/styles'
18 changes: 18 additions & 0 deletions root/grunt/regex-replace.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = (grunt) ->
grunt.config 'regex-replace',
fontello:
src: ['src/fontello/scss/_fontello.scss']
actions: [
{
name: 'font-folder'
search: /\/font\//gmi
replace: (fullstring) ->
'/fonts/'
}
{
name: 'scss-varaibles'
search: /^\.([a-z\-]+):before { content(: '\\[a-z0-9]+';) }(.*)$/gmi
replace: (fullstring, codeName, code, comment) -> '$' + codeName + code + comment
}
]
return
2 changes: 2 additions & 0 deletions root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-connect": "^0.10.1",
"grunt-contrib-copy": "^0.8.1",
"grunt-contrib-cssmin": "^1.0.2",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-criticalcss": "^1.0.3",
"grunt-curl": "^2.2.0",
"grunt-fontello": "github:spanser/grunt-fontello",
"grunt-mkdir": "^1.0.0",
"grunt-regex-replace": "^0.3.0",
"grunt-sass": "^1.0.0",
"grunt-twig-render": "^1.7.2",
"grunt-zip": "^0.17.0",
Expand Down

0 comments on commit f4dc843

Please sign in to comment.