2023-02-28 10:35:20 +00:00
|
|
|
module.exports = (grunt) ->
|
2023-03-01 11:45:58 +00:00
|
|
|
# Load Grunt Tasks
|
|
|
|
require('load-grunt-tasks') grunt
|
2023-02-28 10:35:20 +00:00
|
|
|
|
2023-03-01 11:45:58 +00:00
|
|
|
# Project Configuration
|
|
|
|
grunt.initConfig
|
2023-02-28 10:35:20 +00:00
|
|
|
# NPM Package Declare
|
|
|
|
pkg: grunt.file.readJSON('package.json')
|
|
|
|
# Sass Compile
|
|
|
|
sass:
|
|
|
|
options:
|
|
|
|
implementation: require('sass')
|
|
|
|
exp:
|
|
|
|
options:
|
|
|
|
outputStyle: 'expanded'
|
|
|
|
files:
|
|
|
|
'dist/bundle.css': 'src/index.scss'
|
|
|
|
min:
|
|
|
|
options:
|
|
|
|
outputStyle: 'compressed'
|
|
|
|
files:
|
|
|
|
'dist/bundle.min.css': 'src/index.scss'
|
|
|
|
# PostCSS Process
|
|
|
|
postcss:
|
|
|
|
options:
|
|
|
|
map:
|
|
|
|
inline: false
|
|
|
|
annotation: 'dist/'
|
|
|
|
exp:
|
|
|
|
options:
|
2023-03-01 11:45:58 +00:00
|
|
|
processors: [
|
2023-03-03 10:42:00 +00:00
|
|
|
require('postcss-preset-env')(
|
|
|
|
features:
|
|
|
|
'custom-properties': false
|
|
|
|
)
|
2023-03-01 11:45:58 +00:00
|
|
|
require('autoprefixer')()
|
|
|
|
]
|
2023-02-28 10:35:20 +00:00
|
|
|
src: 'dist/bundle.css'
|
|
|
|
dest: 'dist/bundle.css'
|
|
|
|
min:
|
|
|
|
options:
|
|
|
|
processors: [
|
2023-03-03 10:42:00 +00:00
|
|
|
require('postcss-preset-env')(
|
|
|
|
features:
|
|
|
|
'custom-properties': false
|
|
|
|
)
|
2023-02-28 10:35:20 +00:00
|
|
|
require('autoprefixer')()
|
2023-03-01 11:45:58 +00:00
|
|
|
require('cssnano')(preset: 'default')
|
2023-02-28 10:35:20 +00:00
|
|
|
]
|
|
|
|
src: 'dist/bundle.min.css'
|
|
|
|
dest: 'dist/bundle.min.css'
|
2023-03-01 11:45:58 +00:00
|
|
|
# Register Grunt Tasks
|
|
|
|
grunt.registerTask 'build', [
|
|
|
|
'sass'
|
|
|
|
'postcss'
|
|
|
|
]
|
2023-03-03 10:45:16 +00:00
|
|
|
|
|
|
|
# Authored by @kuohuanhuan.
|