Skip to content
Permalink
Browse files

merge and exclude several files from zip task

  • Loading branch information...
zutrinken committed Jan 23, 2019
2 parents 7ab761e + d7de602 commit b92ade437b4a1f46b59a26a5a52f7474a0c0fab1
Showing with 218 additions and 145 deletions.
  1. +2 −1 .gitignore
  2. +112 −100 Gruntfile.js
  3. +4 −0 README.md
  4. +3 −1 assets/css/style.css
  5. +1 −1 assets/js/script.js
  6. +94 −41 package-lock.json
  7. +2 −1 package.json
@@ -1,2 +1,3 @@
.DS_store
node_modules
node_modules
dist/
@@ -1,107 +1,119 @@
module.exports = function(grunt) {
'use strict';
require('load-grunt-tasks')(grunt, {
pattern: ['grunt-*']
});
'use strict';
require('load-grunt-tasks')(grunt, {
pattern: ['grunt-*']
});

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
config: {
'cssSrcDir': 'src/sass',
'cssTargetDir': 'css',
'jsSrcDir': 'src/js',
'jsTargetDir': 'js'
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
config: {
'cssSrcDir': 'src/sass',
'cssTargetDir': 'css',
'jsSrcDir': 'src/js',
'jsTargetDir': 'js'
},
copy: {
dev: {
files: [{
dest: 'assets/font/',
src: '*',
cwd: 'src/font/',
expand: true
}]
},
dist: {
files: [{
dest: 'assets/font/',
src: '*',
cwd: 'src/font/',
expand: true
}]
}
},
clean: {
dev: ['dev'],
dist: ['dist'],
all: ['dev', 'dist']
},
sass: {
dev: {
options: {
includePaths: ['<%= config.cssSrcDir %>'],
sourceMaps: true
},
copy: {
dev: {
files: [{
dest: 'assets/font/',
src: '*',
cwd: 'src/font/',
expand: true
}]
},
dist: {
files: [{
dest: 'assets/font/',
src: '*',
cwd: 'src/font/',
expand: true
}]
}
},
clean: {
dev: ['dev'],
dist: ['dist'],
all: ['dev', 'dist']
},
sass: {
dev: {
options: {
includePaths: ['<%= config.cssSrcDir %>'],
sourceMaps: true
},
files: {
'assets/<%= config.cssTargetDir %>/style.css': '<%= config.cssSrcDir %>/style.scss'
}
},
dist: {
options: {
outputStyle: 'compressed',
sourceMap: false,
sourceMapEmbed: false
},
files: {
'assets/<%= config.cssTargetDir %>/style.css': '<%= config.cssSrcDir %>/style.scss'
}
}
},
postcss: {
dev: {
options: {
map: true,
processors: [
require('autoprefixer-core')({ browsers: ['last 2 versions'] })
]
},
src: 'assets/<%= config.cssTargetDir %>/*.css'
},
dist: {
options: {
map: false,
processors: [
require('autoprefixer-core')({ browsers: ['last 2 versions'] })
]
},
src: 'assets/<%= config.cssTargetDir %>/*.css'
}
files: {
'assets/<%= config.cssTargetDir %>/style.css': '<%= config.cssSrcDir %>/style.scss'
}
},
dist: {
options: {
outputStyle: 'compressed'
},
uglify: {
js: {
files: {
'assets/<%= config.jsTargetDir %>/script.js': ['<%= config.jsSrcDir %>/libs/jquery-*.js', '<%= config.jsSrcDir %>/**/*.js']
}
}
},
watch: {
css: {
files: '<%= config.cssSrcDir %>/**/*.scss',
tasks: ['sass:dev','copy:dev','postcss:dev']
}
files: {
'assets/<%= config.cssTargetDir %>/style.css': '<%= config.cssSrcDir %>/style.scss'
}
}
},
postcss: {
options: {
map: true,
processors: [
require('autoprefixer')({
browsers: ['last 2 versions']
})
]
},
dev: {
src: 'assets/<%= config.cssTargetDir %>/*.css'
},
dist: {
src: 'assets/<%= config.cssTargetDir %>/*.css'
}
},
uglify: {
js: {
files: {
'assets/<%= config.jsTargetDir %>/script.js': ['<%= config.jsSrcDir %>/libs/jquery-*.js', '<%= config.jsSrcDir %>/**/*.js']
}
});
}
},
watch: {
css: {
files: '<%= config.cssSrcDir %>/**/*.scss',
tasks: ['sass:dev', 'copy:dev', 'postcss:dev']
}
},
zip: {
dist: {
src: [
'**',
'!node_modules',
'!node_modules/**',
'!src',
'!src/**',
'!dist',
'!dist/**',
'!.git',
'!.gitignore',
'!Gruntfile.js',
'!package-lock.json'
],
dest: `dist/${require('./package.json').name}.zip`
}
}
});

grunt.registerTask('build', [
'sass:dist',
'postcss:dist',
'copy:dist',
'uglify'
]);
grunt.registerTask('default', [
'sass:dev',
'postcss:dev',
'copy:dev',
'uglify',
'watch'
]);
grunt.registerTask('build', [
'sass:dist',
'postcss:dist',
'copy:dist',
'uglify'
]);
grunt.registerTask('default', [
'sass:dev',
'postcss:dev',
'copy:dev',
'uglify',
'watch'
]);
};
@@ -53,6 +53,10 @@ Build Grunt project:

grunt build

The zip Grunt task packages the theme files into `dist/<theme-name>.zip`, which you can then upload to your site.

grunt zip

## Copyright & License

Copyright (C) 2015-2019 Peter Amende - Released under the [MIT License](https://github.com/zutrinken/attila/blob/master/LICENSE).

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit b92ade4

Please sign in to comment.
You can’t perform that action at this time.