Browse Source

Iteration on regex for comment replacement

pull/1191/head
jlukic 10 years ago
parent
commit
958cfcc456
7 changed files with 420 additions and 120 deletions
  1. 303
      .csscomb.json
  2. 8
      .gitignore
  3. 22
      build.config
  4. 2
      build.json
  5. 170
      gulpfile.js
  6. 27
      package.json
  7. 8
      src/semantic.config.example

303
.csscomb.json

@ -17,5 +17,306 @@
"space-before-closing-brace": "\n", "space-before-closing-brace": "\n",
"strip-spaces": true, "strip-spaces": true,
"tab-size": true, "tab-size": true,
"vendor-prefix-align": true
"vendor-prefix-align": true,
"sort-order": [
[
"display",
"visibility",
"float",
"clear",
"overflow",
"overflow-x",
"overflow-y",
"-webkit-box-sizing",
"-moz-box-sizing",
"box-sizing",
"-ms-overflow-x",
"-ms-overflow-y",
"clip",
"zoom",
"flex-direction",
"flex-order",
"flex-pack",
"flex-align"
],
[
"position",
"z-index",
"top",
"right",
"bottom",
"left"
],
[
"font",
"font-family",
"font-size",
"font-weight",
"font-style",
"font-variant",
"font-size-adjust",
"font-stretch",
"font-effect",
"font-emphasize",
"font-emphasize-position",
"font-emphasize-style",
"font-smooth",
"line-height"
],
[
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height",
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left"
],
[
"table-layout",
"empty-cells",
"caption-side",
"border-spacing",
"border-collapse",
"list-style",
"list-style-position",
"list-style-type",
"list-style-image"
],
[
"opacity",
"filter:progid:DXImageTransform.Microsoft.Alpha(Opacity",
"-ms-filter:\\'progid:DXImageTransform.Microsoft.Alpha",
"-ms-interpolation-mode",
"color",
"border",
"border-width",
"border-style",
"border-color",
"border-top",
"border-top-width",
"border-top-style",
"border-top-color",
"border-right",
"border-right-width",
"border-right-style",
"border-right-color",
"border-bottom",
"border-bottom-width",
"border-bottom-style",
"border-bottom-color",
"border-left",
"border-left-width",
"border-left-style",
"border-left-color",
"-webkit-border-radius",
"-moz-border-radius",
"border-radius",
"-webkit-border-top-left-radius",
"-moz-border-radius-topleft",
"border-top-left-radius",
"-webkit-border-top-right-radius",
"-moz-border-radius-topright",
"border-top-right-radius",
"-webkit-border-bottom-right-radius",
"-moz-border-radius-bottomright",
"border-bottom-right-radius",
"-webkit-border-bottom-left-radius",
"-moz-border-radius-bottomleft",
"border-bottom-left-radius",
"-webkit-border-image",
"-moz-border-image",
"-o-border-image",
"border-image",
"-webkit-border-image-source",
"-moz-border-image-source",
"-o-border-image-source",
"border-image-source",
"-webkit-border-image-slice",
"-moz-border-image-slice",
"-o-border-image-slice",
"border-image-slice",
"-webkit-border-image-width",
"-moz-border-image-width",
"-o-border-image-width",
"border-image-width",
"-webkit-border-image-outset",
"-moz-border-image-outset",
"-o-border-image-outset",
"border-image-outset",
"-webkit-border-image-repeat",
"-moz-border-image-repeat",
"-o-border-image-repeat",
"border-image-repeat",
"outline",
"outline-width",
"outline-style",
"outline-color",
"outline-offset",
"background",
"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader",
"background-color",
"background-image",
"background-repeat",
"background-attachment",
"background-position",
"background-position-x",
"-ms-background-position-x",
"background-position-y",
"-ms-background-position-y",
"-webkit-background-clip",
"-moz-background-clip",
"background-clip",
"background-origin",
"-webkit-background-size",
"-moz-background-size",
"-o-background-size",
"background-size",
"box-decoration-break",
"-webkit-box-shadow",
"-moz-box-shadow",
"box-shadow",
"filter:progid:DXImageTransform.Microsoft.gradient",
"-ms-filter:\\'progid:DXImageTransform.Microsoft.gradient",
"text-shadow"
],
[
"content",
"quotes",
"counter-reset",
"counter-increment",
"resize",
"cursor",
"-webkit-user-select",
"-moz-user-select",
"-ms-user-select",
"user-select",
"nav-index",
"nav-up",
"nav-right",
"nav-down",
"nav-left",
"-webkit-transition",
"-moz-transition",
"-ms-transition",
"-o-transition",
"transition",
"-webkit-transition-delay",
"-moz-transition-delay",
"-ms-transition-delay",
"-o-transition-delay",
"transition-delay",
"-webkit-transition-timing-function",
"-moz-transition-timing-function",
"-ms-transition-timing-function",
"-o-transition-timing-function",
"transition-timing-function",
"-webkit-transition-duration",
"-moz-transition-duration",
"-ms-transition-duration",
"-o-transition-duration",
"transition-duration",
"-webkit-transition-property",
"-moz-transition-property",
"-ms-transition-property",
"-o-transition-property",
"transition-property",
"-webkit-transform",
"-moz-transform",
"-ms-transform",
"-o-transform",
"transform",
"-webkit-transform-origin",
"-moz-transform-origin",
"-ms-transform-origin",
"-o-transform-origin",
"transform-origin",
"-webkit-animation",
"-moz-animation",
"-ms-animation",
"-o-animation",
"animation",
"-webkit-animation-name",
"-moz-animation-name",
"-ms-animation-name",
"-o-animation-name",
"animation-name",
"-webkit-animation-duration",
"-moz-animation-duration",
"-ms-animation-duration",
"-o-animation-duration",
"animation-duration",
"-webkit-animation-play-state",
"-moz-animation-play-state",
"-ms-animation-play-state",
"-o-animation-play-state",
"animation-play-state",
"-webkit-animation-timing-function",
"-moz-animation-timing-function",
"-ms-animation-timing-function",
"-o-animation-timing-function",
"animation-timing-function",
"-webkit-animation-delay",
"-moz-animation-delay",
"-ms-animation-delay",
"-o-animation-delay",
"animation-delay",
"-webkit-animation-iteration-count",
"-moz-animation-iteration-count",
"-ms-animation-iteration-count",
"-o-animation-iteration-count",
"animation-iteration-count",
"-webkit-animation-direction",
"-moz-animation-direction",
"-ms-animation-direction",
"-o-animation-direction",
"animation-direction",
"text-align",
"-webkit-text-align-last",
"-moz-text-align-last",
"-ms-text-align-last",
"text-align-last",
"vertical-align",
"white-space",
"text-decoration",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-style",
"text-emphasis-position",
"text-indent",
"-ms-text-justify",
"text-justify",
"letter-spacing",
"word-spacing",
"-ms-writing-mode",
"text-outline",
"text-transform",
"text-wrap",
"text-overflow",
"-ms-text-overflow",
"text-overflow-ellipsis",
"text-overflow-mode",
"-ms-word-wrap",
"word-wrap",
"word-break",
"-ms-word-break",
"-moz-tab-size",
"-o-tab-size",
"tab-size",
"-webkit-hyphens",
"-moz-hyphens",
"hyphens",
"pointer-events"
]
]
} }

8
.gitignore

@ -1,13 +1,9 @@
docs/
node_modules
node/server.json
node_modules/
test/coverage/ test/coverage/
coverage/ coverage/
build/**/**/site/
src/build/
src/**/site/ src/**/site/
dist/
src/semantic.config src/semantic.config
build/**/**/semantic.config
semantic.config semantic.config
# Numerous always-ignore extensions # Numerous always-ignore extensions

22
build.config

@ -1,22 +0,0 @@
{
"paths": {
"source": {
"definitions" : "definitions/",
"themes" : "themes/"
},
"output": {
"uncompressed" : "build/uncompressed/",
"minified" : "build/minified/",
"packaged" : "build/packaged/"
}
},
"browserSupport" : [
"last 2 version",
"> 1%",
"opera 12.1",
"safari 6",
"ie 9",
"bb 10",
"android 4"
]
}

2
build.json

@ -1,5 +1,5 @@
{ {
"base": "./",
"base": "",
"paths": { "paths": {
"source": { "source": {

170
gulpfile.js

@ -8,41 +8,83 @@
*/ */
var var
gulp = require('gulp'),
// required components
batch = require('gulp-batch'),
concat = require('gulp-concat'),
gutil = require('gulp-util'),
notify = require('gulp-notify'),
plumber = require('gulp-plumber'),
sass = require('gulp-less'),
uglify = require('gulp-uglify'),
watch = require('gulp-watch')
gulp = require('gulp'),
// read settings file // read settings file
config = require('build.config')
config = require('./build.json'),
// formats comments in output
variableComments = /[\s\S]+\/\* End Config \*\//m,
largeComment = /(\/\*\*\*\*[\s\S]+?\*\/)/mg,
smallComment = /(\/\*---[\s\S]+?\*\/)/mg,
// shorthand
base = config.base,
source = config.paths.source,
output = config.paths.output,
// required node components
del = require('del'),
fs = require('fs'),
// required gulp components
autoprefixer = require('gulp-autoprefixer'),
batch = require('gulp-batch'),
concat = require('gulp-concat'),
copy = require('gulp-copy'),
csscomb = require('gulp-csscomb'),
karma = require('gulp-karma'),
less = require('gulp-less'),
notify = require('gulp-notify'),
plumber = require('gulp-plumber'),
replace = require('gulp-replace'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
util = require('gulp-util'),
watch = require('gulp-watch'),
settings = {
prefix: {
browsers: config.browsers
}
}
; ;
// Add base to all paths
for(var path in source) {
if(source.hasOwnProperty(path)) {
source[path] = base + source[path];
}
}
for(var path in output) {
if(output.hasOwnProperty(path)) {
output[path] = base + output[path];
}
}
/******************************* /*******************************
Commands Commands
*******************************/ *******************************/
// Watches for changes to site and recompiles
/*--------------
User
---------------*/
// Watches for changes to site and recompilesz
gulp.task('default', [ gulp.task('default', [
'watch site',
'watch themes'
'watch src'
]); ]);
// Rebuilds all files // Rebuilds all files
gulp.task('default', [
gulp.task('build', [
'build files' 'build files'
]); ]);
// Rebuilds all files // Rebuilds all files
gulp.task('clean', [ gulp.task('clean', [
'clean output'
'clean dist'
]); ]);
@ -70,46 +112,66 @@ gulp.task('release', [
User User
---------------*/ ---------------*/
// recompile from site change
gulp.task('site changed', function(files) {
console.log('site changed', files);
// cleans distribution files
gulp.task('clean dist', function(callback) {
del([
config.output.compressed,
config.output.minified,
config.output.packaged
], callback);
}); });
// recompile from packaged theme change
gulp.task('theme changed', function(files) {
console.log(files);
});
// recompile less from definition change
gulp.task('library definition changed', function(files) {
console.log(files);
// compile less
// prefix css file
// update concat file
gulp.task('watch src', function () {
// watch for changes in site
gulp.watch(source.site + '**/*.{overrides,variables}', function(file) {
var path;
// recompile definition
path = util.replaceExtension(file.path, '.less');
path = path.replace(source.site, source.definitions);
if( fs.existsSync(path) ) {
console.log('Creating file', path);
return gulp.src(path)
.pipe(plumber())
.pipe(less())
.pipe(autoprefixer(settings.prefix))
.pipe(replace(variableComments, ''))
.pipe(replace(largeComment, '\n\n$1\n'))
.pipe(csscomb())
.pipe(gulp.dest(output.uncompressed))
;
}
else {
console.log('Definition file not found', path);
}
});
});
// clean output directory
gulp.task('clean output', function(files) {
console.log(files);
}); });
/*-------------- /*--------------
Library
Library
---------------*/ ---------------*/
/* These tasks are designed for updates to the core library */ /* These tasks are designed for updates to the core library */
// recompile from library changed
gulp.task('library module changed', function () {
// console.log("Warning: Edited Library File. I hope you know what you're doing")
gulp.task('watch module definition', function () {
watch('src/definitions/**/*.js', function (files, callback) {
gulp.start('library module changed', callback);
});
});
gulp.task('watch definitions', function () {
watch('src/definitions/**/*.less', function (files, callback) {
gulp.start('library definition changed', callback);
});
}); });
// Build release // Build release
@ -120,28 +182,4 @@ gulp.task('build release', function () {
/*-------------- /*--------------
Watch Watch
---------------*/
gulp.task('watch site', function () {
watch('src/_site/**/*(.overrides|.variables)', function (files, callback) {
gulp.start('site files changed', callback);
});
});
gulp.task('watch themes', function () {
watch('themes/**/*(.overrides|.variables)', function (files, callback) {
gulp.start('theme files changed', callback);
});
});
gulp.task('watch module definition', function () {
watch('src/definitions/**/*.js', function (files, callback) {
gulp.start('library module changed', callback);
});
});
gulp.task('watch definitions', function () {
watch('src/definitions/**/*.less', function (files, callback) {
gulp.start('library definition changed', callback);
});
});
---------------*/

27
package.json

@ -20,36 +20,21 @@
"jquery": "x.x.x" "jquery": "x.x.x"
}, },
"devDependencies": { "devDependencies": {
"delete": "^0.1.5",
"grunt": "x.x.x",
"grunt-autoprefixer": "x.x.x",
"grunt-clear": "x.x.x",
"grunt-contrib-clean": "x.x.x",
"grunt-contrib-compress": "x.x.x",
"grunt-contrib-concat": "x.x.x",
"grunt-contrib-copy": "x.x.x",
"grunt-contrib-cssmin": "x.x.x",
"grunt-contrib-less": "x.x.x",
"grunt-contrib-uglify": "x.x.x",
"grunt-contrib-watch": "x.x.x",
"grunt-css": "x.x.x",
"grunt-karma": "x.x.x",
"grunt-karma-coveralls": "x.x.x",
"del": "^0.1.3",
"gulp": "^3.8.8", "gulp": "^3.8.8",
"gulp-autoprefixer": "^1.0.1",
"gulp-batch": "^1.0.1", "gulp-batch": "^1.0.1",
"gulp-concat": "^2.4.1", "gulp-concat": "^2.4.1",
"gulp-copy": "0.0.2", "gulp-copy": "0.0.2",
"gulp-csscomb": "^3.0.3",
"gulp-karma": "0.0.4", "gulp-karma": "0.0.4",
"gulp-less": "^1.3.6", "gulp-less": "^1.3.6",
"gulp-notify": "^2.0.0", "gulp-notify": "^2.0.0",
"gulp-plumber": "^0.6.6", "gulp-plumber": "^0.6.6",
"gulp-replace": "^0.4.0",
"gulp-sourcemaps": "^1.2.4",
"gulp-uglify": "^1.0.1", "gulp-uglify": "^1.0.1",
"gulp-util": "^3.0.1", "gulp-util": "^3.0.1",
"gulp-watch": "^1.1.0",
"karma": "x.x.x",
"karma-coverage": "x.x.x",
"karma-jasmine": "x.x.x",
"karma-phantomjs-launcher": "x.x.x",
"karma-spec-reporter": "x.x.x"
"gulp-watch": "^1.1.0"
} }
} }

8
src/semantic.config.example

@ -10,14 +10,14 @@
*/ */
/******************************* /*******************************
Folders
Folders
*******************************/ *******************************/
/* Path to theme packages */ /* Path to theme packages */
@packagesFolder : 'themes/packages';
@packagesFolder : 'themes/';
/* Path to site override folder */ /* Path to site override folder */
@userFolder : 'themes/_site';
@userFolder : '_site/';
/******************************* /*******************************
@ -121,3 +121,5 @@
@import "@{packagesFolder}/@{theme}/@{type}s/@{element}.overrides"; @import "@{packagesFolder}/@{theme}/@{type}s/@{element}.overrides";
@import "@{userFolder}/@{type}s/@{element}.overrides"; @import "@{userFolder}/@{type}s/@{element}.overrides";
} }
/* End Config */
Loading…
Cancel
Save