mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Use grunt-cson for compilation
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
_ = require 'underscore'
|
||||
CSON = require 'season'
|
||||
|
||||
BUILD_DIR = '/tmp/atom-build/atom-shell'
|
||||
APP_NAME = 'Atom.app'
|
||||
@@ -94,6 +93,8 @@ module.exports = (grunt) ->
|
||||
ext: '.css'
|
||||
|
||||
cson:
|
||||
options:
|
||||
rootObject: true
|
||||
glob_to_multiple:
|
||||
expand: true
|
||||
src: [
|
||||
@@ -154,26 +155,11 @@ module.exports = (grunt) ->
|
||||
|
||||
grunt.loadNpmTasks('grunt-coffeelint')
|
||||
grunt.loadNpmTasks('grunt-lesslint')
|
||||
grunt.loadNpmTasks('grunt-cson')
|
||||
grunt.loadNpmTasks('grunt-contrib-csslint')
|
||||
grunt.loadNpmTasks('grunt-contrib-coffee')
|
||||
grunt.loadNpmTasks('grunt-contrib-less')
|
||||
|
||||
grunt.registerMultiTask 'cson', 'Compile CSON files to JSON', ->
|
||||
for mapping in @files
|
||||
source = mapping.src[0]
|
||||
destination = mapping.dest
|
||||
try
|
||||
object = CSON.readFileSync(source)
|
||||
if !_.isObject(object) or _.isArray(object)
|
||||
grunt.log.error("#{source} does not contain a root object")
|
||||
return false
|
||||
mkdir path.dirname(destination)
|
||||
CSON.writeFileSync(destination, object)
|
||||
grunt.log.writeln("File #{destination.cyan} created.")
|
||||
catch e
|
||||
grunt.log.error("Parsing #{source} failed: #{e.message}")
|
||||
return false
|
||||
|
||||
grunt.registerTask 'postbuild', 'Run postbuild scripts', ->
|
||||
done = @async()
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
"grunt-cli": "~0.1.9",
|
||||
"grunt-coffeelint": "0.0.6",
|
||||
"grunt-lesslint": "0.4.0",
|
||||
"grunt-cson": "0.2.0",
|
||||
"grunt-contrib-csslint": "~0.1.2",
|
||||
"grunt-contrib-coffee": "~0.7.0",
|
||||
"grunt-contrib-less": "~0.5.2"
|
||||
|
||||
Reference in New Issue
Block a user