Move CSS importing code into Gruntfile.coffee.
This commit is contained in:
parent
4446099f1b
commit
5738cd49fb
@ -8,6 +8,12 @@ module.exports = (grunt) ->
|
|||||||
json = (data) ->
|
json = (data) ->
|
||||||
"`#{JSON.stringify(data).replace(/`/g, '\\`')}`"
|
"`#{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) ->
|
importHTML = (filename) ->
|
||||||
html grunt.template.process(grunt.file.read("src/General/html/#{filename}.html").replace(/^ +/gm, '').replace(/\r?\n/g, ''), data: grunt.config('pkg'))
|
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:
|
options: process: Object.create(null, data:
|
||||||
get: ->
|
get: ->
|
||||||
pkg = grunt.config 'pkg'
|
pkg = grunt.config 'pkg'
|
||||||
|
pkg.importCSS = importCSS
|
||||||
pkg.importHTML = importHTML
|
pkg.importHTML = importHTML
|
||||||
pkg.html = html
|
pkg.html = html
|
||||||
pkg.assert = assert
|
pkg.assert = assert
|
||||||
|
|||||||
@ -301,14 +301,7 @@ Main =
|
|||||||
$.ready ->
|
$.ready ->
|
||||||
cb() if Main.isThisPageLegit()
|
cb() if Main.isThisPageLegit()
|
||||||
|
|
||||||
css: `<%=
|
css: `<%= importCSS('font-awesome', 'style', 'yotsuba', 'yotsuba-b', 'futaba', 'burichan', 'tomorrow', 'photon') %>`
|
||||||
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, '\\`')
|
|
||||||
%>`
|
|
||||||
|
|
||||||
features: [
|
features: [
|
||||||
['Polyfill', Polyfill]
|
['Polyfill', Polyfill]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user