1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-24 02:38:15 +04:00

css build, js build

This commit is contained in:
chomik
2019-04-27 14:56:58 +02:00
parent 7c3828aafd
commit 3a45e4e00e
7 changed files with 29 additions and 83 deletions

View File

@@ -1,24 +0,0 @@
const people = require('../pages/_data/people.json'),
fs = require('fs');
let count = {
'Male': 0,
'Female': 0
};
function padTo(number) {
number = (`000${number}`).slice(-3);
return number;
}
people.map(function (person) {
person.photo = 'img/avatars/' + padTo(count[person.gender]) + (person.gender === 'Male' ? 'm' : 'f') + '.jpg';
count[person.gender]++;
});
fs.writeFile('./pages/_data/people.json', JSON.stringify(people), 'utf8', function(err){
if (err) throw err;
});

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env node
var fs = require('fs'),
path = require('path'),
dir = __dirname + '/../img/photos/',
match = RegExp('kaboompics_', 'g'),
files;
files = fs.readdirSync(dir);
function generate_token(length){
//edit the token allowed characters
var a = "abcdef1234567890".split("");
var b = [];
for (var i=0; i<length; i++) {
var j = (Math.random() * (a.length-1)).toFixed(0);
b[i] = a[j];
}
return b.join("");
}
files.forEach(function(file) {
var filePath = path.join(dir, file),
newFilePath = path.join(dir, file.replace(/([0-9a-f]+).*/, "$1.jpg"));
console.log(newFilePath);
fs.renameSync(filePath, newFilePath);
});

View File

@@ -1,14 +1,14 @@
'use strict' 'use strict';
const pkg = require('../package.json') const pkg = require('../package.json');
const year = new Date().getFullYear() const year = new Date().getFullYear();
function getBanner(pluginFilename) { function getBanner(pluginFilename) {
return `/*! return `/*!
* Tabler${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage}) * Tabler${pluginFilename ? ` ${pluginFilename}` : ''} v${pkg.version} (${pkg.homepage})
* Copyright 2018-${year} ${pkg.author} * Copyright 2018-${year} ${pkg.author}
* Licensed under MIT (https://github.com/twbs/tabler/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/tabler/blob/master/LICENSE)
*/` */`;
} }
module.exports = getBanner module.exports = getBanner;

View File

@@ -4,13 +4,13 @@ bs.init({
watch: true, watch: true,
server: { server: {
routes: { routes: {
"/": "tmp", '/': 'tmp',
"/dist": "dist", '/dist': 'dist',
"/libs": "static/libs", '/libs': 'static/libs',
"/img": "static/img", '/img': 'static/img',
} }
}, },
files: ["tmp/**/*", "dist/css/*.css", "dist/js/*.js"], files: ['tmp/**/*', 'dist/css/*.css', 'dist/js/*.js'],
watchOptions: { watchOptions: {
ignoreInitial: true ignoreInitial: true
}, },

View File

@@ -34,11 +34,11 @@ if (BUNDLE) {
// Remove last entry in external array to bundle Popper // Remove last entry in external array to bundle Popper
external.pop(); external.pop();
delete globals['popper.js']; delete globals['popper.js'];
plugins.push(resolve()) plugins.push(resolve());
} }
const rollupConfig = { const rollupConfig = {
input: path.resolve(__dirname, `../js/tabler.js`), input: path.resolve(__dirname, '../js/tabler.js'),
output: { output: {
banner, banner,
file: path.resolve(__dirname, `../dist/js/${fileDest}.js`), file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
@@ -47,10 +47,10 @@ const rollupConfig = {
}, },
external, external,
plugins plugins
} };
if (!ESM) { if (!ESM) {
rollupConfig.output.name = 'tabler' rollupConfig.output.name = 'tabler';
} }
module.exports = rollupConfig module.exports = rollupConfig;

View File

@@ -4,33 +4,32 @@
"description": "Premium and Open Source dashboard template with responsive and high quality UI.", "description": "Premium and Open Source dashboard template with responsive and high quality UI.",
"scripts": { "scripts": {
"start": "npm-run-all --parallel browsersync watch html-watch", "start": "npm-run-all --parallel browsersync watch html-watch",
"build": "npm-run-all lint html-build css-compile js-compile",
"bundlesize": "bundlesize", "bundlesize": "bundlesize",
"html-watch": "JEKYLL_ENV=development bundle exec jekyll build --watch --incremental",
"browsersync": "node build/browsersync.js", "browsersync": "node build/browsersync.js",
"html-watch": "JEKYLL_ENV=development bundle exec jekyll build --watch --incremental",
"html-build": "JEKYLL_ENV=production bundle exec jekyll build",
"lint": "npm-run-all --parallel js-lint css-lint", "lint": "npm-run-all --parallel js-lint css-lint",
"css": "npm-run-all css-compile css-prefix css-minify css-copy", "css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/tabler.scss dist/css/tabler.css",
"css-compile": "echo 'CSS COMPILE' && node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/tabler.scss dist/css/tabler.css",
"css-prefix": "postcss --config build/postcss.config.js --replace \"dist/css/*.css\" \"!dist/css/*.min.css\"", "css-prefix": "postcss --config build/postcss.config.js --replace \"dist/css/*.css\" \"!dist/css/*.min.css\"",
"css-minify": "cleancss --level 1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/tabler.min.css dist/css/tabler.css", "css-minify": "cleancss --level 1 --format breakWith=lf --source-map --source-map-inline-sources --output dist/css/tabler.min.css dist/css/tabler.css",
"css-copy": "cross-env-shell shx mkdir -p site/static/dist/ && cross-env-shell shx cp -r dist/css/ site/static/dist/", "css-copy": "cross-env-shell shx mkdir -p site/static/dist/ && cross-env-shell shx cp -r dist/css/ site/static/dist/",
"css-lint": "stylelint \"scss/**/*.scss\" --cache --cache-location .cache/.stylelintcache", "css-lint": "stylelint \"scss/**/*.scss\" --cache --cache-location .cache/.stylelintcache",
"css-main": "npm-run-all css-compile css-copy", "css-main": "npm-run-all css-compile",
"css-main-build": "npm-run-all css-lint css-compile css-prefix css-minify css-copy", "css-main-build": "npm-run-all css-lint css-compile css-prefix css-minify",
"watch": "npm-run-all --parallel watch-*", "watch": "npm-run-all --parallel watch-*",
"watch-css": "nodemon --watch scss/ --ext scss --exec \"npm run css-main\"", "watch-css": "nodemon --watch scss/ --ext scss --exec \"npm run css-main\"",
"watch-js": "nodemon --watch js/src/ --ext js --exec \"npm run js-compile-standalone\"", "watch-js": "nodemon --watch js/ --ext js --exec \"npm run js-compile-standalone\"",
"js-lint": "eslint --cache --cache-location .cache/.eslintcache js build/",
"v1-html-build": "JEKYLL_ENV=development bundle exec jekyll build --watch --incremental", "js-compile": "npm-run-all --parallel js-compile-* --sequential js-minify",
"v1-js-lint": "eslint --cache --cache-location .cache/.eslintcache js/src build/",
"v1-js-compile": "npm-run-all --parallel js-compile-* --sequential js-copy",
"js-compile-standalone": "rollup --environment BUNDLE:false --config build/rollup.config.js --sourcemap", "js-compile-standalone": "rollup --environment BUNDLE:false --config build/rollup.config.js --sourcemap",
"v1-js-compile-bundle": "rollup --environment BUNDLE:true --config build/rollup.config.js --sourcemap", "js-compile-bundle": "rollup --environment BUNDLE:true --config build/rollup.config.js --sourcemap",
"v1-js-copy": "cross-env-shell shx mkdir -p site/static/dist/ && cross-env-shell shx cp -r dist/js/ site/static/dist/", "js-minify": "npm-run-all js-minify-standalone* js-minify-bundle",
"v1-js-minify": "npm-run-all js-minify-standalone* js-minify-bundle", "js-minify-standalone": "terser --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/tabler.js.map,includeSources,url=tabler.min.js.map\" --output dist/js/tabler.min.js dist/js/tabler.js",
"v1-js-minify-standalone": "terser --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/tabler.js.map,includeSources,url=tabler.min.js.map\" --output dist/js/tabler.min.js dist/js/tabler.js", "js-minify-bundle": "terser --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/tabler.bundle.js.map,includeSources,url=tabler.bundle.min.js.map\" --output dist/js/tabler.bundle.min.js dist/js/tabler.bundle.js"
"v1-js-minify-bundle": "terser --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/tabler.bundle.js.map,includeSources,url=tabler.bundle.min.js.map\" --output dist/js/tabler.bundle.min.js dist/js/tabler.bundle.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -4,7 +4,6 @@ page-title: Dashboard
--- ---
<div class="row row-cards"> <div class="row row-cards">
<div class="col-6 col-sm-4 col-lg-2"> <div class="col-6 col-sm-4 col-lg-2">
{% include cards/small-stats-3.html number=43 title="New Tickets" percentage=6 %} {% include cards/small-stats-3.html number=43 title="New Tickets" percentage=6 %}
</div> </div>
@@ -29,7 +28,6 @@ page-title: Dashboard
{% comment %}{% include cards/development-activity.html %}{% endcomment %} {% comment %}{% include cards/development-activity.html %}{% endcomment %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="alert alert-primary">Are you in trouble? <a href="{{ site.base }}/docs/index.html" class="alert-link">Read our documentation</a> with code samples.</div> <div class="alert alert-primary">Are you in trouble? <a href="{{ site.base }}/docs/index.html" class="alert-link">Read our documentation</a> with code samples.</div>