mirror of
https://github.com/atom/atom.git
synced 2026-02-19 02:44:29 -05:00
Assign package stylesheet context based on double-extension in file name
If stylesheet files are named with 2 extensions, the first extension is used as the context argument when the package’s stylesheets are loaded. This allows people to target the text editor by naming their stylesheet `index.atom-text-editor.less`.
This commit is contained in:
@@ -176,10 +176,15 @@ class Package
|
||||
activateStylesheets: ->
|
||||
return if @stylesheetsActivated
|
||||
|
||||
context = 'atom-text-editor' if @metadata.theme is 'syntax'
|
||||
|
||||
group = @getStylesheetType()
|
||||
@stylesheetDisposables = new CompositeDisposable
|
||||
for [sourcePath, source] in @stylesheets
|
||||
if match = path.basename(sourcePath).match(/[^.]*\.([^.]*)\./)
|
||||
context = match[1]
|
||||
else if @metadata.theme is 'syntax'
|
||||
context = 'atom-text-editor'
|
||||
|
||||
@stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, group, context}))
|
||||
@stylesheetsActivated = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user