diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 1563d1b8..1dd9abd3 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -12,6 +12,7 @@ import ( "os" "path" + "github.com/spf13/afero" "github.com/spf13/cobra" "github.com/sveltinio/sveltin/internal/markup" "github.com/sveltinio/sveltin/internal/migrations" @@ -23,6 +24,7 @@ import ( const ( ProjectSettingsMigrationID string = "projectSettings" DefaultsConfigMigrationID string = "defaultsConfig" + ThemeConfigMigrationID string = "themeConfig" ) //============================================================================= @@ -47,16 +49,24 @@ func RunUpgradeCmd(cmd *cobra.Command, args []string) { cfg.log.Plain(markup.H1(fmt.Sprintf("Upgrading your project to sveltin v%s", CliVersion))) migrationManager := migrations.NewMigrationManager() + // FILE: /sveltin.config.json pathToProjectSettingsFile := path.Join(cwd, ProjectSettingsFile) - addProjectSettingsMigration := handleMigration(ProjectSettingsMigrationID, migrationManager, pathToProjectSettingsFile) + addProjectSettingsMigration := handleMigration(ProjectSettingsMigrationID, migrationManager, cfg, pathToProjectSettingsFile) err := addProjectSettingsMigration.Execute() utils.ExitIfError(err) + // FILE: /config/defaults.js.ts pathToDefaultsConfigFile := path.Join(cwd, cfg.pathMaker.GetConfigFolder(), DefaultsConfigFile) - updateDefaultsConfigMigration := handleMigration(DefaultsConfigMigrationID, migrationManager, pathToDefaultsConfigFile) + updateDefaultsConfigMigration := handleMigration(DefaultsConfigMigrationID, migrationManager, cfg, pathToDefaultsConfigFile) err = updateDefaultsConfigMigration.Execute() utils.ExitIfError(err) + // FILE: /themes//theme.config.js + pathToThemeConfigFile := path.Join(cwd, cfg.pathMaker.GetThemesFolder(), retrieveThemeName(cfg), cfg.settings.GetThemeConfigFilename()) + updateThemeConfigMigration := handleMigration(ThemeConfigMigrationID, migrationManager, cfg, pathToThemeConfigFile) + err = updateThemeConfigMigration.Execute() + utils.ExitIfError(err) + cfg.log.Success(fmt.Sprintf("Your project is ready for sveltin v%s\n", CliVersion)) } @@ -66,43 +76,75 @@ func init() { //============================================================================= -func handleMigration(migrationType string, migrationManager *migrations.MigrationManager, pathToFile string) migrations.Migration { +func handleMigration(migrationType string, migrationManager *migrations.MigrationManager, config appConfig, pathToFile string) migrations.Migration { switch migrationType { case ProjectSettingsMigrationID: - return newAddProjectSettingsMigration(migrationManager, pathToFile) + return newAddProjectSettingsMigration(migrationManager, config, pathToFile) case DefaultsConfigMigrationID: - return newUpdateDefaultsConfigMigration(migrationManager, pathToFile) + return newUpdateDefaultsConfigMigration(migrationManager, config, pathToFile) + case ThemeConfigMigrationID: + return newUpdateThemeConfigMigration(migrationManager, config, pathToFile) default: return nil } } -func newAddProjectSettingsMigration(migrationManager *migrations.MigrationManager, pathTofile string) *migrations.AddProjectSettingsMigration { +func newAddProjectSettingsMigration(migrationManager *migrations.MigrationManager, config appConfig, pathTofile string) *migrations.AddProjectSettingsMigration { return &migrations.AddProjectSettingsMigration{ Mediator: migrationManager, - Fs: cfg.fs, - FsManager: cfg.fsManager, - PathMaker: cfg.pathMaker, - Logger: cfg.log, + Fs: config.fs, + FsManager: config.fsManager, + PathMaker: config.pathMaker, + Logger: config.log, Data: &migrations.MigrationData{ PathToFile: pathTofile, CliVersion: CliVersion, - ProjectCliVersion: cfg.projectSettings.CLI.Version, + ProjectCliVersion: config.projectSettings.CLI.Version, }, } } -func newUpdateDefaultsConfigMigration(migrationManager *migrations.MigrationManager, pathTofile string) *migrations.UpdateDefaultsConfigMigration { +func newUpdateDefaultsConfigMigration(migrationManager *migrations.MigrationManager, config appConfig, pathTofile string) *migrations.UpdateDefaultsConfigMigration { return &migrations.UpdateDefaultsConfigMigration{ Mediator: migrationManager, - Fs: cfg.fs, - FsManager: cfg.fsManager, - PathMaker: cfg.pathMaker, - Logger: cfg.log, + Fs: config.fs, + FsManager: config.fsManager, + PathMaker: config.pathMaker, + Logger: config.log, Data: &migrations.MigrationData{ PathToFile: pathTofile, CliVersion: CliVersion, - ProjectCliVersion: cfg.projectSettings.CLI.Version, + ProjectCliVersion: config.projectSettings.CLI.Version, }, } } + +func newUpdateThemeConfigMigration(migrationManager *migrations.MigrationManager, config appConfig, pathTofile string) *migrations.UpdateThemeConfigMigration { + return &migrations.UpdateThemeConfigMigration{ + Mediator: migrationManager, + Fs: config.fs, + FsManager: config.fsManager, + PathMaker: config.pathMaker, + Logger: config.log, + Data: &migrations.MigrationData{ + PathToFile: pathTofile, + CliVersion: CliVersion, + ProjectCliVersion: config.projectSettings.CLI.Version, + }, + } +} + +//============================================================================= + +func retrieveThemeName(config appConfig) string { + files, err := afero.ReadDir(config.fs, config.pathMaker.GetThemesFolder()) + utils.ExitIfError(err) + + var themeName string + for _, file := range files { + if file.IsDir() { + themeName = file.Name() + } + } + return themeName +} diff --git a/common/fs.go b/common/fs.go index 7bf844eb..6b0b3ac8 100644 --- a/common/fs.go +++ b/common/fs.go @@ -39,7 +39,7 @@ func DirExists(fs afero.Fs, path string) bool { func FileExists(fs afero.Fs, path string) (bool, error) { exists, _ := afero.Exists(fs, path) if !exists { - return false, sveltinerr.NewFileNotFoundError() + return false, sveltinerr.NewFileNotFoundError(path) } isDir, _ := afero.IsDir(fs, path) @@ -91,7 +91,7 @@ func MoveFile(efs *embed.FS, fs afero.Fs, sourceFile string, saveTo string, back func CopyFileFromEmbeddedFS(efs *embed.FS, fs afero.Fs, pathToFile string, saveTo string) error { content, err := efs.ReadFile(pathToFile) if err != nil { - return sveltinerr.NewFileNotFoundError() + return sveltinerr.NewFileNotFoundError(pathToFile) } pathToSaveFile := filepath.Join(saveTo) if err := WriteToDisk(fs, pathToSaveFile, bytes.NewReader(content)); err != nil { diff --git a/common/fs_test.go b/common/fs_test.go index 6b9fe773..32ea8923 100644 --- a/common/fs_test.go +++ b/common/fs_test.go @@ -1,6 +1,7 @@ package common import ( + "fmt" "path/filepath" "testing" @@ -151,7 +152,11 @@ func TestCopyFileFromEmbeddedFS(t *testing.T) { err := CopyFileFromEmbeddedFS(&resources.SveltinFS, memFS, tc.pathToFile, tc.saveTo) re := err.(*sveltinerr.SveltinError) is.Equal(10, int(re.Code)) - is.Equal("please, check the file path", re.Message) + placeholderText := `file not found! Please, check the file path: + +%s` + msg := fmt.Sprintf(placeholderText, tc.pathToFile) + is.Equal(msg, re.Message) } diff --git a/config/defaults.go b/config/defaults.go index 9ef0736c..a5a58b02 100644 --- a/config/defaults.go +++ b/config/defaults.go @@ -121,7 +121,7 @@ func (c *SveltinSettings) GetAPIFilename() string { // GetThemesPath returns a string representing the path to the 'themes' folder // relative to the current working directory. func (c *SveltinSettings) GetThemesPath() string { - return filepath.Join(c.GetProjectRoot(), c.Paths.Themes) + return c.Paths.Themes } // GetThemeConfigFilename returns a string representing the path to the 'themes/theme.config.js' diff --git a/config/defaults_test.go b/config/defaults_test.go index d6a173bf..5a65b0b6 100644 --- a/config/defaults_test.go +++ b/config/defaults_test.go @@ -56,15 +56,15 @@ func TestPaths(t *testing.T) { want string }{ {path: settings.GetBuildPath(), want: filepath.Join(pwd, "build")}, - {path: settings.GetConfigPath(), want: filepath.Join("config")}, - {path: settings.GetContentPath(), want: filepath.Join("content")}, - {path: settings.GetStaticPath(), want: filepath.Join("static")}, - {path: settings.GetSrcPath(), want: filepath.Join("src")}, + {path: settings.GetConfigPath(), want: "config"}, + {path: settings.GetContentPath(), want: "content"}, + {path: settings.GetStaticPath(), want: "static"}, + {path: settings.GetSrcPath(), want: "src"}, {path: settings.GetRoutesPath(), want: filepath.Join("src", "routes")}, {path: settings.GetLibPath(), want: filepath.Join("src", "lib")}, {path: settings.GetParamsPath(), want: filepath.Join("src", "params")}, {path: settings.GetAPIPath(), want: filepath.Join("src", "routes", "api")}, - {path: settings.GetThemesPath(), want: filepath.Join(pwd, "themes")}, + {path: settings.GetThemesPath(), want: "themes"}, } for _, tc := range tests { diff --git a/helpers/templates_test.go b/helpers/templates_test.go index 1f518dcf..b441e4a0 100644 --- a/helpers/templates_test.go +++ b/helpers/templates_test.go @@ -57,9 +57,11 @@ func TestExecSveltinTpl(t *testing.T) { tplConfig := BuildTemplate(pathToTplFile, nil, &data) retrievedContent := tplConfig.Run(&resources.SveltinFS) - validContent := `// theme.config.js file for your sveltin theme -const config = { - name: 'white', + validContent := `import { theme } from '../../sveltin.config.json'; + +// theme.config.js file for your sveltin theme +const themeConfig = { + name: theme.name, version: '0.1', license: 'MIT', licenselink: 'https://github.com/yourname/yourtheme/blob/master/LICENSE', @@ -73,7 +75,7 @@ const config = { }, }; -export default config +export { themeConfig } ` is.Equal(validContent, string(retrievedContent)) } diff --git a/internal/errors/wrapper.go b/internal/errors/wrapper.go index 3ac77d3d..1eb9ec6f 100644 --- a/internal/errors/wrapper.go +++ b/internal/errors/wrapper.go @@ -203,8 +203,8 @@ func NewNotValidGitHubRepoURL(input string) error { } // NewFileNotFoundError ... -func NewFileNotFoundError() error { - err := errors.New("please, check the file path") +func NewFileNotFoundError(pathToFile string) error { + err := fmt.Errorf("file not found! Please, check the file path:\n\n%s", pathToFile) return newSveltinError(fileNotFoundError, "FileNotFoundError", "File Not Found", err.Error(), err) } diff --git a/internal/errors/wrapper_test.go b/internal/errors/wrapper_test.go index 12660e60..eb27f809 100644 --- a/internal/errors/wrapper_test.go +++ b/internal/errors/wrapper_test.go @@ -17,7 +17,7 @@ func TestErrors(t *testing.T) { is.Equal(1, int(re.Code)) is.Equal("DefaultError", re.Name) - errVar = NewFileNotFoundError() + errVar = NewFileNotFoundError("test.example") re = errVar.(*SveltinError) is.Equal("FileNotFoundError", re.Name) diff --git a/internal/migrations/defaults-config-migration.go b/internal/migrations/defaults-config-migration.go index d76578dd..e8fb31fb 100644 --- a/internal/migrations/defaults-config-migration.go +++ b/internal/migrations/defaults-config-migration.go @@ -17,7 +17,6 @@ import ( "github.com/sveltinio/sveltin/common" "github.com/sveltinio/sveltin/internal/fsm" "github.com/sveltinio/sveltin/internal/pathmaker" - "github.com/sveltinio/sveltin/utils" "github.com/sveltinio/yinlog" ) @@ -44,29 +43,30 @@ func (m UpdateDefaultsConfigMigration) Execute() error { func (m *UpdateDefaultsConfigMigration) up() error { if !m.Mediator.canRun(m) { - //m.Logger.Important("DefaultsConfigMigration: awaiting") return nil } exists, err := common.FileExists(m.Fs, m.Data.PathToFile) - utils.ExitIfError(err) + if err != nil { + return err + } + if exists { // regex for semantic versioning - https://ihateregex.io/expr/semver/ pattern := regexp.MustCompile(`(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?`) - if isMigrationRequired(m, pattern) { + if isDefaultsConfigMigrationRequired(m, pattern) { m.Logger.Info(fmt.Sprintf("Migrating %s file", filepath.Base(m.Data.PathToFile))) - err := migrateConfigFile(m, pattern) - utils.ExitIfError(err) + if err := updateConfigFile(m, pattern); err != nil { + return err + } } } - //m.Logger.Plain("DefaultsConfigMigration: Up") return nil } func (m *UpdateDefaultsConfigMigration) down() error { - //m.Logger.Plain("UpdateDefaultsConfigMigration: down") if err := m.Mediator.notifyAboutCompletion(); err != nil { return err } @@ -74,7 +74,6 @@ func (m *UpdateDefaultsConfigMigration) down() error { } func (m *UpdateDefaultsConfigMigration) allowUp() error { - //m.Logger.Plain("UpdateDefaultsConfigMigration: allowUp") if err := m.up(); err != nil { return err } @@ -83,9 +82,11 @@ func (m *UpdateDefaultsConfigMigration) allowUp() error { //============================================================================= -func isMigrationRequired(m *UpdateDefaultsConfigMigration, pattern *regexp.Regexp) bool { +func isDefaultsConfigMigrationRequired(m *UpdateDefaultsConfigMigration, pattern *regexp.Regexp) bool { content, err := afero.ReadFile(m.Fs, m.Data.PathToFile) - utils.ExitIfError(err) + if err != nil { + return false + } lines := strings.Split(string(content), "\n") for _, line := range lines { @@ -97,9 +98,11 @@ func isMigrationRequired(m *UpdateDefaultsConfigMigration, pattern *regexp.Regex return false } -func migrateConfigFile(m *UpdateDefaultsConfigMigration, pattern *regexp.Regexp) error { +func updateConfigFile(m *UpdateDefaultsConfigMigration, pattern *regexp.Regexp) error { content, err := afero.ReadFile(m.Fs, m.Data.PathToFile) - utils.ExitIfError(err) + if err != nil { + return err + } lines := strings.Split(string(content), "\n") for i, line := range lines { diff --git a/internal/migrations/project-settings-migration.go b/internal/migrations/project-settings-migration.go index a13d202f..3f182088 100644 --- a/internal/migrations/project-settings-migration.go +++ b/internal/migrations/project-settings-migration.go @@ -49,7 +49,6 @@ func (m AddProjectSettingsMigration) Execute() error { func (m *AddProjectSettingsMigration) up() error { if !m.Mediator.canRun(m) { - //m.Logger.Important("AddProjectSettingsMigration: awaiting") return nil } @@ -58,7 +57,7 @@ func (m *AddProjectSettingsMigration) up() error { m.Logger.Info(fmt.Sprintf("Creating %s file", filepath.Base(m.Data.PathToFile))) return addProjectSettingsFile(m) } else if exists && m.Data.ProjectCliVersion != m.Data.CliVersion { - m.Logger.Info(fmt.Sprintf("Bump sveltin cli version in %s", filepath.Base(m.Data.PathToFile))) + m.Logger.Info(fmt.Sprintf("Bumping Sveltin CLI version in %s", filepath.Base(m.Data.PathToFile))) return updateFileContent(m) } @@ -66,7 +65,6 @@ func (m *AddProjectSettingsMigration) up() error { } func (m *AddProjectSettingsMigration) down() error { - //m.Logger.Plain("AddProjectSettingsMigration: down") if err := m.Mediator.notifyAboutCompletion(); err != nil { return err } @@ -74,7 +72,6 @@ func (m *AddProjectSettingsMigration) down() error { } func (m *AddProjectSettingsMigration) allowUp() error { - //m.Logger.Plain("AddProjectSettingsMigration: allowUp") if err := m.up(); err != nil { return err } diff --git a/internal/migrations/theme-config-migration.go b/internal/migrations/theme-config-migration.go new file mode 100644 index 00000000..28a70a8a --- /dev/null +++ b/internal/migrations/theme-config-migration.go @@ -0,0 +1,133 @@ +/** + * Copyright © 2021-present Sveltin contributors + * + * Use of this source code is governed by Apache 2.0 license + * that can be found in the LICENSE file. + */ + +package migrations + +import ( + "fmt" + "path/filepath" + "regexp" + "strings" + + "github.com/spf13/afero" + "github.com/sveltinio/sveltin/common" + "github.com/sveltinio/sveltin/internal/fsm" + "github.com/sveltinio/sveltin/internal/pathmaker" + "github.com/sveltinio/yinlog" +) + +// UpdateThemeConfigMigration is the struct representing the migration update the defaults.js.ts file. +type UpdateThemeConfigMigration struct { + Mediator MigrationMediator + Fs afero.Fs + FsManager *fsm.SveltinFSManager + PathMaker *pathmaker.SveltinPathMaker + Logger *yinlog.Logger + Data *MigrationData +} + +// Execute return error if migration execution over up and down methods fails. +func (m UpdateThemeConfigMigration) Execute() error { + if err := m.up(); err != nil { + return err + } + if err := m.down(); err != nil { + return err + } + return nil +} + +func (m *UpdateThemeConfigMigration) up() error { + if !m.Mediator.canRun(m) { + return nil + } + + exists, err := common.FileExists(m.Fs, m.Data.PathToFile) + if err != nil { + return err + } + + if exists { + pattern := regexp.MustCompile("const config = {") + if isThemeConfigMigrationRequired(m, pattern) { + m.Logger.Info(fmt.Sprintf("Migrating %s file", filepath.Base(m.Data.PathToFile))) + if err := updateThemeFile(m); err != nil { + return err + } + } + } + + return nil +} + +func (m *UpdateThemeConfigMigration) down() error { + if err := m.Mediator.notifyAboutCompletion(); err != nil { + return err + } + return nil +} + +func (m *UpdateThemeConfigMigration) allowUp() error { + if err := m.up(); err != nil { + return err + } + return nil +} + +//============================================================================= + +func isThemeConfigMigrationRequired(m *UpdateThemeConfigMigration, pattern *regexp.Regexp) bool { + content, err := afero.ReadFile(m.Fs, m.Data.PathToFile) + if err != nil { + return false + } + + lines := strings.Split(string(content), "\n") + for _, line := range lines { + matches := pattern.FindString(line) + if len(matches) > 0 { + return true + } + } + return false +} + +func updateThemeFile(m *UpdateThemeConfigMigration) error { + content, err := afero.ReadFile(m.Fs, m.Data.PathToFile) + if err != nil { + return err + } + + lines := strings.Split(string(content), "\n") + for i, line := range lines { + var prevLine string + if i != 0 { + prevLine = line + } + if strings.Contains(line, "const config = {") { + newLineContent := `import { theme } from '../../sveltin.config.json'; + +const themeConfig = {` + lines[i] = newLineContent + } else if strings.Contains(line, "name:") && !strings.Contains(prevLine, "author") { + lines[i] = " name: theme.name," + } else if strings.Contains(line, "export default config") { + lines[i] = "export { themeConfig }" + } + } + + output := strings.Join(lines, "\n") + err = m.Fs.Remove(m.Data.PathToFile) + if err != nil { + return err + } + + if err = afero.WriteFile(m.Fs, m.Data.PathToFile, []byte(output), 0644); err != nil { + return err + } + return nil +} diff --git a/resources/internal/templates/themes/blank/tailwindcss/package.json.gotxt b/resources/internal/templates/themes/blank/tailwindcss/package.json.gotxt index 6fd07836..2d618c3d 100644 --- a/resources/internal/templates/themes/blank/tailwindcss/package.json.gotxt +++ b/resources/internal/templates/themes/blank/tailwindcss/package.json.gotxt @@ -25,14 +25,14 @@ "@sveltinio/widgets": "^0.1.7", "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/line-clamp": "^0.4.2", - "@tailwindcss/typography": "^0.5.7", + "@tailwindcss/typography": "^0.5.8", "@types/gtag.js": "^0.0.12", "@types/lodash-es": "^4.17.6", "@types/node": "^18.11.9", "@typescript-eslint/eslint-plugin": "^5.42.1", "@typescript-eslint/parser": "^5.42.1", - "autoprefixer": "^10.4.12", - "cssnano": "^5.1.13", + "autoprefixer": "^10.4.13", + "cssnano": "^5.1.14", "eslint": "^8.27.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-svelte3": "^4.0.0", diff --git a/resources/internal/templates/themes/sveltin/bootstrap/app.html b/resources/internal/templates/themes/sveltin/bootstrap/app.html index 37744baa..b852a038 100644 --- a/resources/internal/templates/themes/sveltin/bootstrap/app.html +++ b/resources/internal/templates/themes/sveltin/bootstrap/app.html @@ -37,7 +37,7 @@ %sveltekit.head% -
%sveltekit.body%
+
%sveltekit.body%
diff --git a/resources/internal/templates/themes/sveltin/bulma/app.html b/resources/internal/templates/themes/sveltin/bulma/app.html index 37744baa..b852a038 100644 --- a/resources/internal/templates/themes/sveltin/bulma/app.html +++ b/resources/internal/templates/themes/sveltin/bulma/app.html @@ -37,7 +37,7 @@ %sveltekit.head% -
%sveltekit.body%
+
%sveltekit.body%
diff --git a/resources/internal/templates/themes/sveltin/scss/app.html b/resources/internal/templates/themes/sveltin/scss/app.html index 37744baa..b852a038 100644 --- a/resources/internal/templates/themes/sveltin/scss/app.html +++ b/resources/internal/templates/themes/sveltin/scss/app.html @@ -37,7 +37,7 @@ %sveltekit.head% -
%sveltekit.body%
+
%sveltekit.body%
diff --git a/resources/internal/templates/themes/sveltin/tailwindcss/app.html b/resources/internal/templates/themes/sveltin/tailwindcss/app.html index f8906dad..6c42d0e3 100644 --- a/resources/internal/templates/themes/sveltin/tailwindcss/app.html +++ b/resources/internal/templates/themes/sveltin/tailwindcss/app.html @@ -30,7 +30,7 @@ %sveltekit.head% -
%sveltekit.body%
+
%sveltekit.body%
diff --git a/resources/internal/templates/themes/sveltin/tailwindcss/package.json.gotxt b/resources/internal/templates/themes/sveltin/tailwindcss/package.json.gotxt index 6fd07836..2d618c3d 100644 --- a/resources/internal/templates/themes/sveltin/tailwindcss/package.json.gotxt +++ b/resources/internal/templates/themes/sveltin/tailwindcss/package.json.gotxt @@ -25,14 +25,14 @@ "@sveltinio/widgets": "^0.1.7", "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/line-clamp": "^0.4.2", - "@tailwindcss/typography": "^0.5.7", + "@tailwindcss/typography": "^0.5.8", "@types/gtag.js": "^0.0.12", "@types/lodash-es": "^4.17.6", "@types/node": "^18.11.9", "@typescript-eslint/eslint-plugin": "^5.42.1", "@typescript-eslint/parser": "^5.42.1", - "autoprefixer": "^10.4.12", - "cssnano": "^5.1.13", + "autoprefixer": "^10.4.13", + "cssnano": "^5.1.14", "eslint": "^8.27.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-svelte3": "^4.0.0", diff --git a/resources/internal/templates/themes/sveltin/vanillacss/app.html b/resources/internal/templates/themes/sveltin/vanillacss/app.html index 37744baa..b852a038 100644 --- a/resources/internal/templates/themes/sveltin/vanillacss/app.html +++ b/resources/internal/templates/themes/sveltin/vanillacss/app.html @@ -37,7 +37,7 @@ %sveltekit.head% -
%sveltekit.body%
+
%sveltekit.body%
diff --git a/resources/internal/templates/themes/theme.config.js.gotxt b/resources/internal/templates/themes/theme.config.js.gotxt index a0e567ae..d3f99a4b 100644 --- a/resources/internal/templates/themes/theme.config.js.gotxt +++ b/resources/internal/templates/themes/theme.config.js.gotxt @@ -1,6 +1,8 @@ +import { theme } from '../../sveltin.config.json'; + // theme.config.js file for your sveltin theme -const config = { - name: '{{ .Theme.Name }}', +const themeConfig = { + name: theme.name, version: '0.1', license: 'MIT', licenselink: 'https://github.com/yourname/yourtheme/blob/master/LICENSE', @@ -14,4 +16,4 @@ const config = { }, }; -export default config +export { themeConfig }