importCSS
This commit is contained in:
parent
03ec051087
commit
c6aa15c64d
@ -1,6 +1,9 @@
|
|||||||
module.exports = (grunt) ->
|
module.exports = (grunt) ->
|
||||||
grunt.util.linefeed = '\n'
|
grunt.util.linefeed = '\n'
|
||||||
|
|
||||||
|
importCSS = (filename) ->
|
||||||
|
"\"\"\"#{grunt.file.read("src/General/css/#{filename}.css").replace(/\s+/g, ' ').trim()}\"\"\""
|
||||||
|
|
||||||
importHTML = (filename) ->
|
importHTML = (filename) ->
|
||||||
"(innerHTML: #{JSON.stringify(grunt.file.read("src/General/html/#{filename}.html").replace(/^\s+|\s+$</gm, '').replace(/\n/g, '')).replace(/\\\\u/g, '\\u')})"
|
"(innerHTML: #{JSON.stringify(grunt.file.read("src/General/html/#{filename}.html").replace(/^\s+|\s+$</gm, '').replace(/\n/g, '')).replace(/\\\\u/g, '\\u')})"
|
||||||
|
|
||||||
@ -37,6 +40,7 @@ module.exports = (grunt) ->
|
|||||||
get: ->
|
get: ->
|
||||||
pkg = grunt.config 'pkg'
|
pkg = grunt.config 'pkg'
|
||||||
pkg.importHTML = importHTML
|
pkg.importHTML = importHTML
|
||||||
|
pkg.importCSS = importCSS
|
||||||
pkg.html = html
|
pkg.html = html
|
||||||
pkg.assert = assert
|
pkg.assert = assert
|
||||||
pkg.tests_enabled or= false
|
pkg.tests_enabled or= false
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,16 +1,16 @@
|
|||||||
#mascot img {
|
#mascot img {
|
||||||
height: #{
|
height: #{
|
||||||
if mascot.height and isNaN parseFloat mascot.height
|
if mascot.height and isNaN parseFloat mascot.height then
|
||||||
mascot.height
|
mascot.height
|
||||||
else if mascot.height
|
else if mascot.height then
|
||||||
parseInt(mascot.height, 10) + 'px'
|
parseInt(mascot.height, 10) + 'px'
|
||||||
else
|
else
|
||||||
'auto'
|
'auto'
|
||||||
};
|
};
|
||||||
width: #{
|
width: #{
|
||||||
if mascot.width and isNaN parseFloat mascot.width
|
if mascot.width and isNaN parseFloat mascot.width then
|
||||||
mascot.width
|
mascot.width
|
||||||
else if mascot.width
|
else if mascot.width then
|
||||||
parseInt(mascot.width, 10) + 'px'
|
parseInt(mascot.width, 10) + 'px'
|
||||||
else
|
else
|
||||||
'auto'
|
'auto'
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
JSColor =
|
JSColor =
|
||||||
css: ->
|
css: ->
|
||||||
"""<%= grunt.file.read('src/General/css/jscolor.css').replace(/\s+/g, ' ').trim() %>"""
|
<%= importCSS('jscolor') %>
|
||||||
|
|
||||||
bind: (el) ->
|
bind: (el) ->
|
||||||
el.color = new JSColor.color(el) if not el.color
|
el.color = new JSColor.color(el) if not el.color
|
||||||
|
|||||||
@ -399,4 +399,4 @@ MascotTools =
|
|||||||
position: (mascot) ->
|
position: (mascot) ->
|
||||||
return unless Style.sheets.mascots
|
return unless Style.sheets.mascots
|
||||||
mascot.image? or mascot = Mascots[Conf['mascot']] or {} # event
|
mascot.image? or mascot = Mascots[Conf['mascot']] or {} # event
|
||||||
Style.sheets.mascots.textContent = """<%= grunt.file.read('src/General/css/mascot.css') %>"""
|
Style.sheets.mascots.textContent = <%= importCSS('mascot') %>
|
||||||
|
|||||||
@ -2,10 +2,10 @@ Style =
|
|||||||
sheets: {}
|
sheets: {}
|
||||||
init: ->
|
init: ->
|
||||||
Style.svgs = {
|
Style.svgs = {
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
el: $.el 'div',
|
el: $.el 'div',
|
||||||
id: 'svg_filters'
|
id: 'svg_filters'
|
||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
||||||
theme = Themes[Conf[g.THEMESTRING]] or Themes['Yotsuba B']
|
theme = Themes[Conf[g.THEMESTRING]] or Themes['Yotsuba B']
|
||||||
@ -26,8 +26,8 @@ Style =
|
|||||||
|
|
||||||
$.asap (-> d.body), @asapInit
|
$.asap (-> d.body), @asapInit
|
||||||
$.asap (-> Header.bar.parentElement), Style.padding
|
$.asap (-> Header.bar.parentElement), Style.padding
|
||||||
|
$.asap (-> $.id 'boardNavDesktopFoot' ), @readyInit
|
||||||
$.on window, "resize", Style.padding
|
$.on window, "resize", Style.padding
|
||||||
$.ready @readyInit
|
|
||||||
|
|
||||||
asapInit: ->
|
asapInit: ->
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
@ -95,11 +95,8 @@ Style =
|
|||||||
silhouette: ([fg]) ->
|
silhouette: ([fg]) ->
|
||||||
"0 0 0 0 #{fg.r} 0 0 0 0 #{fg.g} 0 0 0 0 #{fg.b}"
|
"0 0 0 0 #{fg.r} 0 0 0 0 #{fg.g} 0 0 0 0 #{fg.b}"
|
||||||
|
|
||||||
layout: """<%=
|
layout:
|
||||||
grunt.file.read('src/General/css/layout.css').replace(/\s+/g, ' ').trim()
|
<%= importCSS('layout') %> + ' ' + <%= importCSS('font-awesome') %>
|
||||||
+ ' ' +
|
|
||||||
grunt.file.read('src/General/css/font-awesome.css').replace(/\s+/g, ' ').replace(/\\/g, '\\\\').trim()
|
|
||||||
%>"""
|
|
||||||
|
|
||||||
dynamic: ->
|
dynamic: ->
|
||||||
sidebarLocation = if Conf["Sidebar Location"] is "left"
|
sidebarLocation = if Conf["Sidebar Location"] is "left"
|
||||||
@ -116,7 +113,7 @@ Style =
|
|||||||
left: 0
|
left: 0
|
||||||
right: 0
|
right: 0
|
||||||
|
|
||||||
"""<%= grunt.file.read('src/General/css/dynamic.css').replace(/\s+/g, ' ').trim() %>"""
|
<%= importCSS('dynamic') %>
|
||||||
|
|
||||||
setTheme: (theme) -> Style.sheets.theme.textContent = Style.theme theme
|
setTheme: (theme) -> Style.sheets.theme.textContent = Style.theme theme
|
||||||
|
|
||||||
@ -144,14 +141,15 @@ Style =
|
|||||||
Style.svgs.el.innerHTML = svgs.join ''
|
Style.svgs.el.innerHTML = svgs.join ''
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
"""<%= grunt.file.read('src/General/css/theme.css').replace(/\s+/g, ' ').trim() %>""" + <%= grunt.file.read('src/General/css/themeoptions.css').replace(/\s+/g, ' ').trim() %>
|
<%= importCSS('theme') %> + ' ' + <%= importCSS('themeoptions') %>
|
||||||
|
|
||||||
iconPositions: ->
|
iconPositions: ->
|
||||||
# Slideout Navigation
|
# Slideout Navigation
|
||||||
slideNav = $.el 'span',
|
slideNav = $.el 'span',
|
||||||
id: 'so-nav'
|
id: 'so-nav'
|
||||||
innerHTML: '<i class=a-icon></a>'
|
|
||||||
$.add slideNav, $.id('boardNavDesktopFoot')
|
$.extend slideNav, <%= html('<i class="a-icon"></a>') %>
|
||||||
|
$.add slideNav, $.id 'boardNavDesktopFoot'
|
||||||
Header.addShortcut slideNav, true
|
Header.addShortcut slideNav, true
|
||||||
|
|
||||||
# Announcements
|
# Announcements
|
||||||
@ -159,7 +157,7 @@ Style =
|
|||||||
if (psa = $.id 'globalMessage') and !psa.hidden
|
if (psa = $.id 'globalMessage') and !psa.hidden
|
||||||
psaIcon = $.el 'i',
|
psaIcon = $.el 'i',
|
||||||
id: 'so-psa'
|
id: 'so-psa'
|
||||||
innerHTML: '<i class=a-icon></a>'
|
$.extend psaIcon, <%= html('<i class="a-icon"></a>') %>
|
||||||
$.add psaIcon, psa
|
$.add psaIcon, psa
|
||||||
Header.addShortcut psaIcon, true
|
Header.addShortcut psaIcon, true
|
||||||
|
|
||||||
@ -173,7 +171,7 @@ Style =
|
|||||||
padding: ->
|
padding: ->
|
||||||
navHeight = Header.bar.offsetHeight
|
navHeight = Header.bar.offsetHeight
|
||||||
pageHeight = ($ '.pagelist', d.body)?.offsetHeight or 15
|
pageHeight = ($ '.pagelist', d.body)?.offsetHeight or 15
|
||||||
Style.sheets.padding.textContent = """<%= grunt.file.read('src/General/css/padding.nav.css').replace(/\s+/g, ' ').trim() %> """ +
|
Style.sheets.padding.textContent = <%= importCSS('padding.nav') %> +
|
||||||
if pageHeight
|
if pageHeight
|
||||||
"""<%= grunt.file.read('src/General/css/padding.pages.css').replace(/\s+/g, ' ').trim() %>"""
|
' ' + <%= importCSS('padding.pages') %>
|
||||||
else ''
|
else ''
|
||||||
@ -311,7 +311,7 @@ ThemeTools =
|
|||||||
'Inputs': "rgb(#{textColor.rgb()})"
|
'Inputs': "rgb(#{textColor.rgb()})"
|
||||||
'Warnings': "rgb(#{sageColor.rgb()})"
|
'Warnings': "rgb(#{sageColor.rgb()})"
|
||||||
'Shadow Color': "rbga(0,0,0,0.1)"
|
'Shadow Color': "rbga(0,0,0,0.1)"
|
||||||
'Custom CSS': """<%= grunt.file.read('src/General/css/theme.import.css') %> #{imported.customCSS or ''}"""
|
'Custom CSS': <%= importCSS('theme.import') %> + " #{imported.customCSS or ''}"
|
||||||
|
|
||||||
else
|
else
|
||||||
Themes[name] = imported
|
Themes[name] = imported
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user