Example #1
0
func (app *AppShell) buildJavaScripts(entry string) error {
	rootConfig.RLock()
	if rootConfig.Assets == nil {
		rootConfig.RUnlock()
		return nil
	}
	rootConfig.RUnlock()

	if entry == APP_SHELL_JS_TASK_INIT_ENTRY_KEY {
		if err := assets.CheckMkdir("public/javascripts"); err != nil {
			return err
		}
		return app.buildAssetsTraverse(app.buildJavaScripts)
	}

	if entry == "" {
		if err := assets.ResetDir("public/javascripts", true); err != nil {
			return err
		}
		if err := app.genAssetsMapping(); err != nil {
			return err
		}
		return app.buildAssetsTraverse(app.buildJavaScripts)
	}

	rootConfig.RLock()
	defer rootConfig.RUnlock()
	return assets.JavaScript(*rootConfig.Assets, entry).Build(app.isProduction)
}
Example #2
0
func (app *AppShell) buildJavaScripts(entry string) error {
	rootConfig.RLock()
	if rootConfig.Assets == nil {
		rootConfig.RUnlock()
		return nil
	}
	rootConfig.RUnlock()

	if entry == "" {
		if err := assets.ResetDir("public/javascripts", true); err != nil {
			return err
		}
		return app.buildAssetsTraverse(app.buildJavaScripts)
	}

	rootConfig.RLock()
	defer rootConfig.RUnlock()
	return assets.JavaScript(*rootConfig.Assets, entry).Build(app.isProduction)
}