import themeX = require ( '../../themeX' ) ; import tmTheme = require ( '../../libs/tmTheme' ) ; import fs = require ( 'fs-extra' ) ; import path = require ( 'path' ) ; export const id = 'org.karyfoundation.themeX.sublime' ; export const editorName = 'Sublime Text' ; export const editorId = 'sublime' ; export const version = '1.0.0' ; export const author = 'Kary Foundation, Inc.' ; export function generate ( project , address ) { let sublimeBuildDir = themeX . adaptorBuildDirectoryPath ( this , address ) ; themeX . forEachThemeDo ( project , address , theme => { createSublimeThemeFiles ( theme , sublimeBuildDir ) ; } ) ; } function createSublimeThemeFiles ( theme , dir ) { let themeCode = tmTheme ( theme ) ; let fileName = `${ themeX . getFileNameForTheme ( theme ) }.tmTheme` ; fs . writeFile ( path . join ( dir , fileName ) , themeCode , error => { if ( error ) themeX . report ( `could not build: ${ fileName }` ) ; } ) ; }