mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Only require platform stylesheet if it exists
Make requireStylesheet throw exception if the stylesheet does not exist
This commit is contained in:
committed by
Kevin Sawicki
parent
1a8e36d6b7
commit
c53f87fcba
@@ -55,8 +55,8 @@ windowAdditions =
|
||||
$(@rootViewParentSelector).append @rootView
|
||||
|
||||
requireStylesheet: (path) ->
|
||||
fullPath = require.resolve(path)
|
||||
return unless fs.isFile(fullPath)
|
||||
unless fullPath = require.resolve(path)
|
||||
throw new Error("requireStylesheet could not find a file at path '#{path}'")
|
||||
window.applyStylesheet(fullPath, fs.read(fullPath))
|
||||
|
||||
applyStylesheet: (id, text) ->
|
||||
@@ -107,4 +107,6 @@ require 'underscore-extensions'
|
||||
|
||||
requireStylesheet 'reset.css'
|
||||
requireStylesheet 'atom.css'
|
||||
requireStylesheet "#{$native.getPlatform()}.css"
|
||||
|
||||
if nativeStylesheetPath = require.resolve("#{platform}.css")
|
||||
requireStylesheet(nativeStylesheetPath)
|
||||
|
||||
Reference in New Issue
Block a user