Move CSS importing code into Gruntfile.coffee.

This commit is contained in:
ccd0 2015-06-16 09:48:09 -07:00
parent 4446099f1b
commit 5738cd49fb
2 changed files with 8 additions and 8 deletions

View File

@ -8,6 +8,12 @@ module.exports = (grunt) ->
json = (data) ->
"`#{JSON.stringify(data).replace(/`/g, '\\`')}`"
importCSS = (filenames...) ->
grunt.template.process(
filenames.map((name) -> grunt.file.read "src/General/css/#{name}.css").join(''),
{data: grunt.config 'pkg'}
).trim().replace(/\n+/g, '\n').split(/^/m).map(JSON.stringify).join(' +\n').replace(/`/g, '\\`')
importHTML = (filename) ->
html grunt.template.process(grunt.file.read("src/General/html/#{filename}.html").replace(/^ +/gm, '').replace(/\r?\n/g, ''), data: grunt.config('pkg'))
@ -69,6 +75,7 @@ module.exports = (grunt) ->
options: process: Object.create(null, data:
get: ->
pkg = grunt.config 'pkg'
pkg.importCSS = importCSS
pkg.importHTML = importHTML
pkg.html = html
pkg.assert = assert

View File

@ -301,14 +301,7 @@ Main =
$.ready ->
cb() if Main.isThisPageLegit()
css: `<%=
grunt.template.process(
['font-awesome', 'style', 'yotsuba', 'yotsuba-b', 'futaba', 'burichan', 'tomorrow', 'photon'].map(function(name) {
return grunt.file.read('src/General/css/'+name+'.css');
}).join(''),
{data: {type: type}}
).trim().replace(/\n+/g, '\n').split(/^/m).map(JSON.stringify).join(' +\n').replace(/`/g, '\\`')
%>`
css: `<%= importCSS('font-awesome', 'style', 'yotsuba', 'yotsuba-b', 'futaba', 'burichan', 'tomorrow', 'photon') %>`
features: [
['Polyfill', Polyfill]