mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge remote-tracking branch 'origin/dev' into md-preview-redux
Conflicts: src/packages/markdown-preview/stylesheets/markdown-preview.css static/atom.css static/command-panel.css
This commit is contained in:
@@ -5,10 +5,10 @@ module.exports =
|
||||
class AtomTheme extends Theme
|
||||
|
||||
loadStylesheet: (stylesheetPath)->
|
||||
@stylesheets[stylesheetPath] = fs.read(stylesheetPath)
|
||||
@stylesheets[stylesheetPath] = window.loadStylesheet(stylesheetPath)
|
||||
|
||||
load: ->
|
||||
if fs.extension(@path) is '.css'
|
||||
if fs.extension(@path) in ['.css', '.less']
|
||||
@loadStylesheet(@path)
|
||||
else
|
||||
metadataPath = fs.resolveExtension(fs.join(@path, 'package'), ['cson', 'json'])
|
||||
@@ -17,6 +17,6 @@ class AtomTheme extends Theme
|
||||
if stylesheetNames
|
||||
@loadStylesheet(fs.join(@path, name)) for name in stylesheetNames
|
||||
else
|
||||
@loadStylesheet(stylesheetPath) for stylesheetPath in fs.list(@path, ['.css'])
|
||||
@loadStylesheet(stylesheetPath) for stylesheetPath in fs.list(@path, ['.css', '.less'])
|
||||
|
||||
super
|
||||
|
||||
@@ -37,16 +37,16 @@ class Config
|
||||
templateConfigDirPath = fs.resolve(window.resourcePath, 'dot-atom')
|
||||
|
||||
onConfigDirFile = (path) =>
|
||||
templatePath = fs.join(templateConfigDirPath, path)
|
||||
configPath = fs.join(@configDirPath, path)
|
||||
fs.write(configPath, fs.read(templatePath))
|
||||
relativePath = path.substring(templateConfigDirPath.length + 1)
|
||||
configPath = fs.join(@configDirPath, relativePath)
|
||||
fs.write(configPath, fs.read(path))
|
||||
fs.traverseTree(templateConfigDirPath, onConfigDirFile, (path) -> true)
|
||||
|
||||
configThemeDirPath = fs.join(@configDirPath, 'themes')
|
||||
onThemeDirFile = (path) ->
|
||||
templatePath = fs.join(bundledThemesDirPath, path)
|
||||
configPath = fs.join(configThemeDirPath, path)
|
||||
fs.write(configPath, fs.read(templatePath))
|
||||
relativePath = path.substring(bundledThemesDirPath.length + 1)
|
||||
configPath = fs.join(configThemeDirPath, relativePath)
|
||||
fs.write(configPath, fs.read(path))
|
||||
fs.traverseTree(bundledThemesDirPath, onThemeDirFile, (path) -> true)
|
||||
|
||||
load: ->
|
||||
|
||||
@@ -61,7 +61,7 @@ class Editor extends View
|
||||
else
|
||||
{editSession, @mini} = (editSessionOrOptions ? {})
|
||||
|
||||
requireStylesheet 'editor.css'
|
||||
requireStylesheet 'editor.less'
|
||||
|
||||
@id = Editor.nextEditorId++
|
||||
@lineCache = []
|
||||
|
||||
@@ -20,7 +20,7 @@ class SelectList extends View
|
||||
cancelling: false
|
||||
|
||||
initialize: ->
|
||||
requireStylesheet 'select-list.css'
|
||||
requireStylesheet 'select-list.less'
|
||||
|
||||
@miniEditor.getBuffer().on 'changed', => @schedulePopulateList()
|
||||
@miniEditor.on 'focusout', => @cancel() unless @cancelling
|
||||
|
||||
@@ -11,7 +11,7 @@ class Theme
|
||||
if fs.exists(name)
|
||||
path = name
|
||||
else
|
||||
path = fs.resolve(config.themeDirPaths..., name, ['', '.tmTheme', '.css'])
|
||||
path = fs.resolve(config.themeDirPaths..., name, ['', '.tmTheme', '.css', 'less'])
|
||||
|
||||
throw new Error("No theme exists named '#{name}'") unless path
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
fs = require 'fs'
|
||||
$ = require 'jquery'
|
||||
ChildProcess = require 'child-process'
|
||||
{less} = require 'less'
|
||||
require 'jquery-extensions'
|
||||
require 'underscore-extensions'
|
||||
require 'space-pen-extensions'
|
||||
@@ -24,17 +25,17 @@ window.setUpEnvironment = ->
|
||||
$(document).on 'keydown', keymap.handleKeyEvent
|
||||
keymap.bindDefaultKeys()
|
||||
|
||||
requireStylesheet 'reset.css'
|
||||
requireStylesheet 'atom.css'
|
||||
requireStylesheet 'tabs.css'
|
||||
requireStylesheet 'tree-view.css'
|
||||
requireStylesheet 'status-bar.css'
|
||||
requireStylesheet 'command-panel.css'
|
||||
requireStylesheet 'fuzzy-finder.css'
|
||||
requireStylesheet 'overlay.css'
|
||||
requireStylesheet 'popover-list.css'
|
||||
requireStylesheet 'notification.css'
|
||||
requireStylesheet 'markdown.css'
|
||||
requireStylesheet 'reset.less'
|
||||
requireStylesheet 'atom.less'
|
||||
requireStylesheet 'tabs.less'
|
||||
requireStylesheet 'tree-view.less'
|
||||
requireStylesheet 'status-bar.less'
|
||||
requireStylesheet 'command-panel.less'
|
||||
requireStylesheet 'fuzzy-finder.less'
|
||||
requireStylesheet 'overlay.less'
|
||||
requireStylesheet 'popover-list.less'
|
||||
requireStylesheet 'notification.less'
|
||||
requireStylesheet 'markdown.less'
|
||||
|
||||
if nativeStylesheetPath = require.resolve("#{platform}.css")
|
||||
requireStylesheet(nativeStylesheetPath)
|
||||
@@ -117,10 +118,21 @@ window.stylesheetElementForId = (id) ->
|
||||
|
||||
window.requireStylesheet = (path) ->
|
||||
if fullPath = require.resolve(path)
|
||||
window.applyStylesheet(fullPath, fs.read(fullPath))
|
||||
unless fullPath
|
||||
content = window.loadStylesheet(fullPath)
|
||||
window.applyStylesheet(fullPath, content)
|
||||
else
|
||||
console.log "bad", path
|
||||
throw new Error("Could not find a file at path '#{path}'")
|
||||
|
||||
window.loadStylesheet = (path) ->
|
||||
content = fs.read(path)
|
||||
if fs.extension(path) == '.less'
|
||||
(new less.Parser).parse content, (e, tree) ->
|
||||
throw new Error(e.message, file, e.line) if e
|
||||
content = tree.toCSS()
|
||||
|
||||
content
|
||||
|
||||
window.removeStylesheet = (path) ->
|
||||
unless fullPath = require.resolve(path)
|
||||
throw new Error("Could not find a file at path '#{path}'")
|
||||
|
||||
Reference in New Issue
Block a user