Änderungen admin
This commit is contained in:
5
test/node_modules/startbootstrap-sb-admin/scripts/build-assets.js
generated
vendored
Normal file
5
test/node_modules/startbootstrap-sb-admin/scripts/build-assets.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const renderAssets = require('./render-assets');
|
||||
|
||||
renderAssets();
|
19
test/node_modules/startbootstrap-sb-admin/scripts/build-pug.js
generated
vendored
Normal file
19
test/node_modules/startbootstrap-sb-admin/scripts/build-pug.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
const upath = require('upath');
|
||||
const sh = require('shelljs');
|
||||
const renderPug = require('./render-pug');
|
||||
|
||||
const srcPath = upath.resolve(upath.dirname(__filename), '../src');
|
||||
|
||||
sh.find(srcPath).forEach(_processFile);
|
||||
|
||||
function _processFile(filePath) {
|
||||
if (
|
||||
filePath.match(/\.pug$/)
|
||||
&& !filePath.match(/include/)
|
||||
&& !filePath.match(/mixin/)
|
||||
&& !filePath.match(/\/pug\/layouts\//)
|
||||
) {
|
||||
renderPug(filePath);
|
||||
}
|
||||
}
|
5
test/node_modules/startbootstrap-sb-admin/scripts/build-scripts.js
generated
vendored
Normal file
5
test/node_modules/startbootstrap-sb-admin/scripts/build-scripts.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const renderScripts = require('./render-scripts');
|
||||
|
||||
renderScripts();
|
5
test/node_modules/startbootstrap-sb-admin/scripts/build-scss.js
generated
vendored
Normal file
5
test/node_modules/startbootstrap-sb-admin/scripts/build-scss.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const renderSCSS = require('./render-scss');
|
||||
|
||||
renderSCSS();
|
7
test/node_modules/startbootstrap-sb-admin/scripts/clean.js
generated
vendored
Normal file
7
test/node_modules/startbootstrap-sb-admin/scripts/clean.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const sh = require('shelljs');
|
||||
const upath = require('upath');
|
||||
|
||||
const destPath = upath.resolve(upath.dirname(__filename), '../dist');
|
||||
|
||||
sh.rm('-rf', `${destPath}/*`)
|
||||
|
11
test/node_modules/startbootstrap-sb-admin/scripts/render-assets.js
generated
vendored
Normal file
11
test/node_modules/startbootstrap-sb-admin/scripts/render-assets.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const upath = require('upath');
|
||||
const sh = require('shelljs');
|
||||
|
||||
module.exports = function renderAssets() {
|
||||
const sourcePath = upath.resolve(upath.dirname(__filename), '../src/assets');
|
||||
const destPath = upath.resolve(upath.dirname(__filename), '../dist/.');
|
||||
|
||||
sh.cp('-R', sourcePath, destPath)
|
||||
};
|
35
test/node_modules/startbootstrap-sb-admin/scripts/render-pug.js
generated
vendored
Normal file
35
test/node_modules/startbootstrap-sb-admin/scripts/render-pug.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const upath = require('upath');
|
||||
const pug = require('pug');
|
||||
const sh = require('shelljs');
|
||||
const prettier = require('prettier');
|
||||
|
||||
module.exports = function renderPug(filePath) {
|
||||
const destPath = filePath.replace(/src\/pug\/\pages/, 'dist').replace(/\.pug$/, '.html');
|
||||
const srcPath = upath.resolve(upath.dirname(__filename), '../src');
|
||||
|
||||
console.log(`### INFO: Rendering ${filePath} to ${destPath}`);
|
||||
const html = pug.renderFile(filePath, {
|
||||
doctype: 'html',
|
||||
filename: filePath,
|
||||
basedir: srcPath
|
||||
});
|
||||
|
||||
const destPathDirname = upath.dirname(destPath);
|
||||
if (!sh.test('-e', destPathDirname)) {
|
||||
sh.mkdir('-p', destPathDirname);
|
||||
}
|
||||
|
||||
const prettified = prettier.format(html, {
|
||||
printWidth: 1000,
|
||||
tabWidth: 4,
|
||||
singleQuote: true,
|
||||
proseWrap: 'preserve',
|
||||
endOfLine: 'lf',
|
||||
parser: 'html',
|
||||
htmlWhitespaceSensitivity: 'ignore'
|
||||
});
|
||||
|
||||
fs.writeFileSync(destPath, prettified);
|
||||
};
|
26
test/node_modules/startbootstrap-sb-admin/scripts/render-scripts.js
generated
vendored
Normal file
26
test/node_modules/startbootstrap-sb-admin/scripts/render-scripts.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const packageJSON = require('../package.json');
|
||||
const upath = require('upath');
|
||||
const sh = require('shelljs');
|
||||
|
||||
module.exports = function renderScripts() {
|
||||
|
||||
const sourcePath = upath.resolve(upath.dirname(__filename), '../src/js');
|
||||
const destPath = upath.resolve(upath.dirname(__filename), '../dist/.');
|
||||
|
||||
sh.cp('-R', sourcePath, destPath)
|
||||
|
||||
const sourcePathScriptsJS = upath.resolve(upath.dirname(__filename), '../src/js/scripts.js');
|
||||
const destPathScriptsJS = upath.resolve(upath.dirname(__filename), '../dist/js/scripts.js');
|
||||
|
||||
const copyright = `/*!
|
||||
* Start Bootstrap - ${packageJSON.title} v${packageJSON.version} (${packageJSON.homepage})
|
||||
* Copyright 2013-${new Date().getFullYear()} ${packageJSON.author}
|
||||
* Licensed under ${packageJSON.license} (https://github.com/StartBootstrap/${packageJSON.name}/blob/master/LICENSE)
|
||||
*/
|
||||
`
|
||||
const scriptsJS = fs.readFileSync(sourcePathScriptsJS);
|
||||
|
||||
fs.writeFileSync(destPathScriptsJS, copyright + scriptsJS);
|
||||
};
|
42
test/node_modules/startbootstrap-sb-admin/scripts/render-scss.js
generated
vendored
Normal file
42
test/node_modules/startbootstrap-sb-admin/scripts/render-scss.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
const autoprefixer = require('autoprefixer')
|
||||
const fs = require('fs');
|
||||
const packageJSON = require('../package.json');
|
||||
const upath = require('upath');
|
||||
const postcss = require('postcss')
|
||||
const sass = require('sass');
|
||||
const sh = require('shelljs');
|
||||
|
||||
const stylesPath = '../src/scss/styles.scss';
|
||||
const destPath = upath.resolve(upath.dirname(__filename), '../dist/css/styles.css');
|
||||
|
||||
module.exports = function renderSCSS() {
|
||||
|
||||
const results = sass.renderSync({
|
||||
data: entryPoint,
|
||||
includePaths: [
|
||||
upath.resolve(upath.dirname(__filename), '../node_modules')
|
||||
],
|
||||
});
|
||||
|
||||
const destPathDirname = upath.dirname(destPath);
|
||||
if (!sh.test('-e', destPathDirname)) {
|
||||
sh.mkdir('-p', destPathDirname);
|
||||
}
|
||||
|
||||
postcss([ autoprefixer ]).process(results.css, {from: 'styles.css', to: 'styles.css'}).then(result => {
|
||||
result.warnings().forEach(warn => {
|
||||
console.warn(warn.toString())
|
||||
})
|
||||
fs.writeFileSync(destPath, result.css.toString());
|
||||
})
|
||||
|
||||
};
|
||||
|
||||
const entryPoint = `/*!
|
||||
* Start Bootstrap - ${packageJSON.title} v${packageJSON.version} (${packageJSON.homepage})
|
||||
* Copyright 2013-${new Date().getFullYear()} ${packageJSON.author}
|
||||
* Licensed under ${packageJSON.license} (https://github.com/StartBootstrap/${packageJSON.name}/blob/master/LICENSE)
|
||||
*/
|
||||
@import "${stylesPath}"
|
||||
`
|
86
test/node_modules/startbootstrap-sb-admin/scripts/sb-watch.js
generated
vendored
Normal file
86
test/node_modules/startbootstrap-sb-admin/scripts/sb-watch.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const chokidar = require('chokidar');
|
||||
const upath = require('upath');
|
||||
const renderAssets = require('./render-assets');
|
||||
const renderPug = require('./render-pug');
|
||||
const renderScripts = require('./render-scripts');
|
||||
const renderSCSS = require('./render-scss');
|
||||
|
||||
const watcher = chokidar.watch('src', {
|
||||
persistent: true,
|
||||
});
|
||||
|
||||
let READY = false;
|
||||
|
||||
process.title = 'pug-watch';
|
||||
process.stdout.write('Loading');
|
||||
let allPugFiles = {};
|
||||
|
||||
watcher.on('add', filePath => _processFile(upath.normalize(filePath), 'add'));
|
||||
watcher.on('change', filePath => _processFile(upath.normalize(filePath), 'change'));
|
||||
watcher.on('ready', () => {
|
||||
READY = true;
|
||||
console.log(' READY TO ROLL!');
|
||||
});
|
||||
|
||||
_handleSCSS();
|
||||
|
||||
function _processFile(filePath, watchEvent) {
|
||||
|
||||
if (!READY) {
|
||||
if (filePath.match(/\.pug$/)) {
|
||||
if (!filePath.match(/includes/) && !filePath.match(/mixins/) && !filePath.match(/\/pug\/layouts\//)) {
|
||||
allPugFiles[filePath] = true;
|
||||
}
|
||||
}
|
||||
process.stdout.write('.');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`### INFO: File event: ${watchEvent}: ${filePath}`);
|
||||
|
||||
if (filePath.match(/\.pug$/)) {
|
||||
return _handlePug(filePath, watchEvent);
|
||||
}
|
||||
|
||||
if (filePath.match(/\.scss$/)) {
|
||||
if (watchEvent === 'change') {
|
||||
return _handleSCSS(filePath, watchEvent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (filePath.match(/src\/js\//)) {
|
||||
return renderScripts();
|
||||
}
|
||||
|
||||
if (filePath.match(/src\/assets\//)) {
|
||||
return renderAssets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function _handlePug(filePath, watchEvent) {
|
||||
if (watchEvent === 'change') {
|
||||
if (filePath.match(/includes/) || filePath.match(/mixins/) || filePath.match(/\/pug\/layouts\//)) {
|
||||
return _renderAllPug();
|
||||
}
|
||||
return renderPug(filePath);
|
||||
}
|
||||
if (!filePath.match(/includes/) && !filePath.match(/mixins/) && !filePath.match(/\/pug\/layouts\//)) {
|
||||
return renderPug(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
function _renderAllPug() {
|
||||
console.log('### INFO: Rendering All');
|
||||
_.each(allPugFiles, (value, filePath) => {
|
||||
renderPug(filePath);
|
||||
});
|
||||
}
|
||||
|
||||
function _handleSCSS() {
|
||||
renderSCSS();
|
||||
}
|
24
test/node_modules/startbootstrap-sb-admin/scripts/start-debug.js
generated
vendored
Normal file
24
test/node_modules/startbootstrap-sb-admin/scripts/start-debug.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
const concurrently = require('concurrently');
|
||||
const upath = require('upath');
|
||||
|
||||
const browserSyncPath = upath.resolve(upath.dirname(__filename), '../node_modules/.bin/browser-sync');
|
||||
|
||||
concurrently([
|
||||
{ command: 'node --inspect scripts/sb-watch.js', name: 'SB_WATCH', prefixColor: 'bgBlue.bold' },
|
||||
{
|
||||
command: `${browserSyncPath} dist -w --no-online`,
|
||||
name: 'SB_BROWSER_SYNC',
|
||||
prefixColor: 'bgBlue.bold',
|
||||
}
|
||||
], {
|
||||
prefix: 'name',
|
||||
killOthers: ['failure', 'success'],
|
||||
}).then(success, failure);
|
||||
|
||||
function success() {
|
||||
console.log('Success');
|
||||
}
|
||||
|
||||
function failure() {
|
||||
console.log('Failure');
|
||||
}
|
24
test/node_modules/startbootstrap-sb-admin/scripts/start.js
generated
vendored
Normal file
24
test/node_modules/startbootstrap-sb-admin/scripts/start.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
const concurrently = require('concurrently');
|
||||
const upath = require('upath');
|
||||
|
||||
const browserSyncPath = upath.resolve(upath.dirname(__filename), '../node_modules/.bin/browser-sync');
|
||||
|
||||
concurrently([
|
||||
{ command: 'node scripts/sb-watch.js', name: 'SB_WATCH', prefixColor: 'bgBlue.bold' },
|
||||
{
|
||||
command: `"${browserSyncPath}" --reload-delay 2000 --reload-debounce 2000 dist -w --no-online`,
|
||||
name: 'SB_BROWSER_SYNC',
|
||||
prefixColor: 'bgGreen.bold',
|
||||
}
|
||||
], {
|
||||
prefix: 'name',
|
||||
killOthers: ['failure', 'success'],
|
||||
}).then(success, failure);
|
||||
|
||||
function success() {
|
||||
console.log('Success');
|
||||
}
|
||||
|
||||
function failure() {
|
||||
console.log('Failure');
|
||||
}
|
Reference in New Issue
Block a user