Skip to content

Commit

Permalink
Added padding to progress bar container.
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyonnetti committed Sep 21, 2023
1 parent 695890d commit 9fc5e4f
Show file tree
Hide file tree
Showing 5 changed files with 310 additions and 264 deletions.
61 changes: 33 additions & 28 deletions claroalter_base/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ const uglifyjs = require('uglify-js')

const writeFile = util.promisify(fs.writeFile)

// paths
const path = {
styles: {
src: './src/sass/style.scss',
dest: './css/style.css',
watch: './src/sass/*.scss'
},
toolbar: {
src: './src/sass/toolbar.scss',
dest: './css/toolbar.css'
},
scripts: {
src: './src/js/script.js',
dest: './js/script.js',
watch: './src/js/*.js'
}
}

function bsync () {
browserSync.init({
port: 3110,
Expand All @@ -19,7 +37,7 @@ function bsync () {
ghostMode: false,
notify: true,
reloadOnRestart: true,
files: ['css/style.css', 'css/toolbar.css', 'js/min/script.js'],
files: [path.styles.dest, path.toolbar.dest, path.scripts.dest],
snippetOptions: {
// Load Browsersync inject code before the closing body tag
// in-order to avoid issues with D10's admin toolbar.
Expand All @@ -33,26 +51,6 @@ function bsync () {
})
}

// paths
const path = {
styles: {
src: './src/sass/style.scss',
dest: './css/style.css',
watch: './src/sass/*.scss'
},
toolbar: {
src: './src/sass/toolbar.scss',
dest: './css/toolbar.css'
},
scripts: {
src: './src/js/script.js',
dest: './js/script.js',
watch: './src/js/*.js'
}
}

// ----------------------------------------------------------------------------

// Function to compile Sass to CSS
function compileSass () {
const result = sass.compile(path.styles.src, {
Expand Down Expand Up @@ -83,6 +81,7 @@ async function buildCSS () {
try {
// Compile Sass to CSS
const sassResult = compileSass()

// create embeded sass sourcemap.
const sassMap = JSON.stringify(sassResult.sourceMap)
// convert soucres to relative paths.
Expand Down Expand Up @@ -118,8 +117,6 @@ async function buildCSS () {
}
}

// ----------------------------------------------------------------------------

// Function to compile Toolbar Sass to CSS
function compileToolbarSass () {
const result = sass.compile(path.toolbar.src, {
Expand Down Expand Up @@ -150,6 +147,7 @@ async function buildToolbarCSS () {
try {
// Compile Sass to CSS
const sassResult = compileToolbarSass()

// create embeded sass sourcemap.
const sassMap = JSON.stringify(sassResult.sourceMap)
// convert soucres to relative paths.
Expand Down Expand Up @@ -185,8 +183,6 @@ async function buildToolbarCSS () {
}
}

// ----------------------------------------------------------------------------

// Function to compress JavaScript
function compressJS () {
const jsCode = fs.readFileSync(path.scripts.src, 'utf8')
Expand All @@ -211,18 +207,27 @@ function minifyJS () {
// Compress JavaScript using UglifyJS
const jsResult = compressJS()

// Replace "sources" value with file name.
const jsResultMap = JSON.parse(jsResult.map)
const emptySourceValue = '0'
const fileSourceValue = '../' + path.scripts.srcFile
// Find the index of the old value in the sources array
const sourceIndex = jsResultMap.sources.indexOf(emptySourceValue)
// If the old value is found, replace it with the new value
if (sourceIndex !== -1) {
jsResultMap.sources[sourceIndex] = fileSourceValue
}

// Write the compressed JavaScript and sourcemap to files
writeFile(path.scripts.dest, jsResult.code)
writeFile(path.scripts.dest + '.map', jsResult.map)
writeFile(path.scripts.dest + '.map', JSON.stringify(jsResultMap))

console.log('UglifyJS complete!')
} catch (error) {
console.error('UglifyJS error:', error)
}
}

// ----------------------------------------------------------------------------

// Run BrowserSync
function watchFiles () {
bsync()
Expand Down
3 changes: 3 additions & 0 deletions claroalter_base/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion claroalter_base/css/style.css.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions claroalter_base/src/sass/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ a:focus,

.layout-container {
margin: 0 !important;

.progress {
padding: 0 3rem 2rem;
}
}
}

Expand Down
Loading

0 comments on commit 9fc5e4f

Please sign in to comment.