From bbf7c6ca1b75f3fb22f352731f2ea916c75b9e79 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 12 Apr 2013 13:21:17 -0600 Subject: [PATCH] Replace requireStylesheet calls w/ @import directives in atom.less --- src/app/config.coffee | 1 + src/app/window.coffee | 12 +++--- static/atom.less | 92 +++---------------------------------------- static/root-view.less | 86 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 92 deletions(-) create mode 100644 static/root-view.less diff --git a/src/app/config.coffee b/src/app/config.coffee index 79cb4d35e..6fd2f1c54 100644 --- a/src/app/config.coffee +++ b/src/app/config.coffee @@ -17,6 +17,7 @@ class Config themeDirPaths: [userThemesDirPath, bundledThemesDirPath, vendoredThemesDirPath] packageDirPaths: [userPackagesDirPath, vendoredPackagesDirPath, bundledPackagesDirPath] userPackagesDirPath: userPackagesDirPath + lessSearchPaths: [fsUtils.join(resourcePath, 'static')] defaultSettings: null settings: null configFileHasErrors: null diff --git a/src/app/window.coffee b/src/app/window.coffee index ab5003871..f9ac267c1 100644 --- a/src/app/window.coffee +++ b/src/app/window.coffee @@ -25,12 +25,7 @@ window.setUpEnvironment = -> $(document).on 'keydown', keymap.handleKeyEvent keymap.bindDefaultKeys() - requireStylesheet 'reset' requireStylesheet 'atom' - requireStylesheet 'overlay' - requireStylesheet 'popover-list' - requireStylesheet 'notification' - requireStylesheet 'markdown' if nativeStylesheetPath = fsUtils.resolveOnLoadPath(process.platform, ['css', 'less']) requireStylesheet(nativeStylesheetPath) @@ -142,7 +137,12 @@ window.requireStylesheet = (path) -> window.loadStylesheet = (path) -> content = fsUtils.read(path) if fsUtils.extension(path) == '.less' - (new less.Parser({})).parse content, (e, tree) -> + parser = new less.Parser + syncImport: true + paths: config.lessSearchPaths + filename: path + + parser.parse content, (e, tree) -> throw new Error(e.message, path, e.line) if e content = tree.toCSS() diff --git a/static/atom.less b/static/atom.less index f58c62d76..ee43336ae 100644 --- a/static/atom.less +++ b/static/atom.less @@ -1,86 +1,6 @@ -html, body { - width: 100%; - height: 100%; - overflow: hidden; -} - -#root-view { - height: 100%; - overflow: hidden; - position: relative; - - #horizontal { - display: -webkit-flex; - height: 100%; - } - - #vertical { - display: -webkit-flex; - -webkit-flex: 1; - -webkit-flex-flow: column; - } -} - -#panes { - position: relative; - -webkit-flex: 1; - - .column { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - overflow-y: hidden; - } - - .row { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - overflow-x: hidden; - } - - .pane { - position: absolute; - display: -webkit-flex; - -webkit-flex-flow: column; - top: 0; - bottom: 0; - left: 0; - right: 0; - box-sizing: border-box; - } - - .pane .item-views { - -webkit-flex: 1; - display: -webkit-flex; - -webkit-flex-flow: column; - } - - .pane .item-views > * { - -webkit-flex: 1; - min-height: 0; - } -} - -@font-face { - font-family: 'Octicons Regular'; - src: url("octicons-regular-webfont.woff") format("woff"); - font-weight: normal; - font-style: normal; -} - -.is-loading { - background-image: url(images/spinner.svg); - background-repeat: no-repeat; - width: 14px; - height: 14px; - opacity: 0.5; - background-size: contain; - position: relative; - display: inline-block; - padding-left: 19px; -} +@import "reset.less"; +@import "root-view.less"; +@import "overlay.less"; +@import "popover-list.less"; +@import "notification.less"; +@import "markdown.less"; diff --git a/static/root-view.less b/static/root-view.less new file mode 100644 index 000000000..f58c62d76 --- /dev/null +++ b/static/root-view.less @@ -0,0 +1,86 @@ +html, body { + width: 100%; + height: 100%; + overflow: hidden; +} + +#root-view { + height: 100%; + overflow: hidden; + position: relative; + + #horizontal { + display: -webkit-flex; + height: 100%; + } + + #vertical { + display: -webkit-flex; + -webkit-flex: 1; + -webkit-flex-flow: column; + } +} + +#panes { + position: relative; + -webkit-flex: 1; + + .column { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + overflow-y: hidden; + } + + .row { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + overflow-x: hidden; + } + + .pane { + position: absolute; + display: -webkit-flex; + -webkit-flex-flow: column; + top: 0; + bottom: 0; + left: 0; + right: 0; + box-sizing: border-box; + } + + .pane .item-views { + -webkit-flex: 1; + display: -webkit-flex; + -webkit-flex-flow: column; + } + + .pane .item-views > * { + -webkit-flex: 1; + min-height: 0; + } +} + +@font-face { + font-family: 'Octicons Regular'; + src: url("octicons-regular-webfont.woff") format("woff"); + font-weight: normal; + font-style: normal; +} + +.is-loading { + background-image: url(images/spinner.svg); + background-repeat: no-repeat; + width: 14px; + height: 14px; + opacity: 0.5; + background-size: contain; + position: relative; + display: inline-block; + padding-left: 19px; +}