mirror of https://github.com/statping/statping
CDN asset changes, SCSS entry file change
parent
0ee9cffb78
commit
8e603ceda0
|
@ -4,6 +4,9 @@
|
|||
- Modified notifications to not send on initial startup
|
||||
- Updated Incident UI
|
||||
- Added additional testing for notifications
|
||||
- Modified SCSS/SASS files to be generated from 1, main.scss to main.css
|
||||
- Modified index page to use /assets directory for assets, (main.css, style.css)
|
||||
- Modified index page to use CDN asset paths
|
||||
|
||||
# 0.90.61 (07-22-2020)
|
||||
- Modified sass layouts, organized and split up sections
|
||||
|
|
4
Makefile
4
Makefile
|
@ -136,7 +136,9 @@ frontend-build:
|
|||
@rm -rf source/dist && rm -rf frontend/dist
|
||||
@echo "yarn install and build static frontend"
|
||||
cd frontend && yarn && yarn build
|
||||
@cp -r frontend/dist source/ && cp -r frontend/src/assets/scss source/dist/
|
||||
@cp -r frontend/dist source/
|
||||
@cp -r frontend/src/assets/scss source/dist/
|
||||
@cp -r frontend/public/main.scss source/dist/scss/
|
||||
@cp -r source/tmpl/*.* source/dist/
|
||||
@cp -r frontend/public/favicon source/dist/
|
||||
@echo "Frontend build complete at ./source/dist"
|
||||
|
|
|
@ -60,6 +60,9 @@ const webpackConfig = merge(commonConfig, {
|
|||
plugins: [
|
||||
new webpack.EnvironmentPlugin(environment),
|
||||
new CleanWebpackPlugin(),
|
||||
new webpack.optimize.LimitChunkCountPlugin({
|
||||
maxChunks: 1
|
||||
}),
|
||||
new MiniCSSExtractPlugin({
|
||||
filename: 'css/[name].css',
|
||||
chunkFilename: 'css/[name].css'
|
||||
|
|
|
@ -43,12 +43,9 @@
|
|||
<meta property="twitter:image" content="favicon/social.png">
|
||||
|
||||
{{if USE_CDN}}
|
||||
<link rel="stylesheet" href="https://assets.statping.com/vendor.css">
|
||||
<link rel="stylesheet" href="https://assets.statping.com/style.css">
|
||||
<link rel="stylesheet" href="https://assets.statping.com/main.css">
|
||||
{{else}}
|
||||
{{if USING_ASSETS}}
|
||||
<link href="css/vendor.css" rel="stylesheet">
|
||||
{{else if USING_ASSETS }}
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
<link href="css/main.css" rel="stylesheet">
|
||||
{{else}}
|
||||
|
@ -66,10 +63,14 @@
|
|||
|
||||
{{if USE_CDN}}
|
||||
<script src="https://assets.statping.com/bundle.js"></script>
|
||||
<script src="https://assets.statping.com/vendor.chunk.js"></script>
|
||||
<script src="https://assets.statping.com/polyfill.chunk.js"></script>
|
||||
<script src="https://assets.statping.com/style.chunk.js"></script>
|
||||
<script src="https://assets.statping.com/main.chunk.js"></script>
|
||||
{{else if USING_ASSETS }}
|
||||
<script src="js/bundle.js"></script>
|
||||
<script src="js/polyfill.chunk.js"></script>
|
||||
<script src="js/style.chunk.js"></script>
|
||||
<script src="js/main.chunk.js"></script>
|
||||
{{else}}
|
||||
<% _.each(htmlWebpackPlugin.tags.bodyTags, function(bodyTag) { %>
|
||||
<%= bodyTag %> <% }) %>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
@import 'variables';
|
||||
@import 'mixin';
|
||||
@import 'base';
|
||||
@import 'forms';
|
||||
@import 'layout';
|
||||
@import 'mobile';
|
|
@ -49,21 +49,20 @@ func CompileSASS(files ...string) error {
|
|||
sassBin = bin
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
scssFile := filepath.Join(utils.Params.GetString("STATPING_DIR"), "assets", file)
|
||||
log.Infoln(fmt.Sprintf("Compiling SASS %v into %v", scssFile, scssRendered(scssFile)))
|
||||
scssFile := filepath.Join(utils.Params.GetString("STATPING_DIR"), "assets", "scss", "main.scss")
|
||||
log.Infoln(fmt.Sprintf("Compiling SASS %v into %v", scssFile, scssRendered(scssFile)))
|
||||
|
||||
stdout, stderr, err := utils.Command(sassBin, scssFile, scssRendered(scssFile))
|
||||
if err != nil {
|
||||
log.Errorln(fmt.Sprintf("Failed to compile assets with SASS %v", err))
|
||||
log.Errorln(fmt.Sprintf("%s %s %s", sassBin, scssFile, scssRendered(scssFile)))
|
||||
return errors.Wrapf(err, "failed to compile assets, %s %s %s", err, stdout, stderr)
|
||||
}
|
||||
|
||||
if stdout != "" || stderr != "" {
|
||||
log.Infoln(fmt.Sprintf("out: %v | error: %v", stdout, stderr))
|
||||
}
|
||||
stdout, stderr, err := utils.Command(sassBin, scssFile, scssRendered(scssFile))
|
||||
if err != nil {
|
||||
log.Errorln(fmt.Sprintf("Failed to compile assets with SASS %v", err))
|
||||
log.Errorln(fmt.Sprintf("%s %s %s", sassBin, scssFile, scssRendered(scssFile)))
|
||||
return errors.Wrapf(err, "failed to compile assets, %s %s %s", err, stdout, stderr)
|
||||
}
|
||||
|
||||
if stdout != "" || stderr != "" {
|
||||
log.Infoln(fmt.Sprintf("out: %v | error: %v", stdout, stderr))
|
||||
}
|
||||
|
||||
log.Infoln("SASS Compiling is complete!")
|
||||
return nil
|
||||
}
|
||||
|
@ -103,10 +102,10 @@ func SaveAsset(data []byte, path string) error {
|
|||
|
||||
// OpenAsset returns a file's contents as a string
|
||||
func OpenAsset(path string) string {
|
||||
path = fmt.Sprintf("%s/assets/%s", utils.Directory, path)
|
||||
path = filepath.Join(utils.Directory, "assets", path)
|
||||
data, err := utils.OpenFile(path)
|
||||
if err != nil {
|
||||
log.Errorln(fmt.Sprintf("Failed to open %v, %v", path, err))
|
||||
log.Errorln(fmt.Sprintf("Failed to open %s, %v", path, err))
|
||||
return ""
|
||||
}
|
||||
return data
|
||||
|
@ -114,7 +113,7 @@ func OpenAsset(path string) string {
|
|||
|
||||
// CreateAllAssets will dump HTML, CSS, SCSS, and JS assets into the '/assets' directory
|
||||
func CreateAllAssets(folder string) error {
|
||||
log.Infoln(fmt.Sprintf("Dump Statping assets into %v/assets", folder))
|
||||
log.Infoln(fmt.Sprintf("Dump Statping assets into %s/assets", folder))
|
||||
fp := filepath.Join
|
||||
|
||||
if err := MakePublicFolder(fp(folder, "/assets")); err != nil {
|
||||
|
|
|
@ -25,12 +25,16 @@ func TestCore_UsingAssets(t *testing.T) {
|
|||
|
||||
func TestCreateAssets(t *testing.T) {
|
||||
assert.Nil(t, CreateAllAssets(dir))
|
||||
assert.FileExists(t, dir+"/assets/js/bundle.js")
|
||||
assert.True(t, UsingAssets(dir))
|
||||
assert.Nil(t, CompileSASS(DefaultScss...))
|
||||
assert.FileExists(t, dir+"/assets/css/style.css")
|
||||
assert.FileExists(t, dir+"/assets/css/vendor.css")
|
||||
assert.FileExists(t, dir+"/assets/css/main.css")
|
||||
assert.FileExists(t, dir+"/assets/scss/main.scss")
|
||||
assert.FileExists(t, dir+"/assets/scss/base.scss")
|
||||
assert.FileExists(t, dir+"/assets/scss/forms.scss")
|
||||
assert.FileExists(t, dir+"/assets/scss/mobile.scss")
|
||||
assert.FileExists(t, dir+"/assets/scss/layout.scss")
|
||||
assert.FileExists(t, dir+"/assets/scss/variables.scss")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue