Update Semantic
Fixes #40,#24
This commit is contained in:
parent
1715f27f44
commit
2027b94179
621 changed files with 172488 additions and 15939 deletions
38
web/semantic/tasks/config/admin/github.js
Normal file
38
web/semantic/tasks/config/admin/github.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*******************************
|
||||
GitHub Login
|
||||
*******************************/
|
||||
/*
|
||||
Logs into GitHub using OAuth
|
||||
*/
|
||||
|
||||
var
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
githubAPI = require('github'),
|
||||
|
||||
// stores oauth info for GitHub API
|
||||
oAuthConfig = path.join(__dirname, 'oauth.js'),
|
||||
oAuth = fs.existsSync(oAuthConfig)
|
||||
? require(oAuthConfig)
|
||||
: false,
|
||||
github
|
||||
;
|
||||
|
||||
if(!oAuth) {
|
||||
console.log('here');
|
||||
console.error('Must add oauth token for GitHub in tasks/config/admin/oauth.js');
|
||||
}
|
||||
|
||||
github = new githubAPI({
|
||||
version : '3.0.0',
|
||||
debug : true,
|
||||
protocol : 'https',
|
||||
timeout : 5000
|
||||
});
|
||||
|
||||
github.authenticate({
|
||||
type: 'oauth',
|
||||
token: oAuth.token
|
||||
});
|
||||
|
||||
module.exports = github;
|
10
web/semantic/tasks/config/admin/oauth.example.js
Normal file
10
web/semantic/tasks/config/admin/oauth.example.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
Used to import GitHub Auth Token
|
||||
To Automate GitHub Updates
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
token : 'AN-OAUTH2-TOKEN',
|
||||
name : 'Your Name',
|
||||
email : 'user@email.com'
|
||||
};
|
110
web/semantic/tasks/config/admin/release.js
Normal file
110
web/semantic/tasks/config/admin/release.js
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*******************************
|
||||
Release Settings
|
||||
*******************************/
|
||||
|
||||
// release settings
|
||||
module.exports = {
|
||||
|
||||
// path to components for repos
|
||||
source : './dist/components/',
|
||||
|
||||
// modified asset paths for component repos
|
||||
paths: {
|
||||
source : '../themes/default/assets/',
|
||||
output : 'assets/'
|
||||
},
|
||||
|
||||
templates: {
|
||||
bower : './tasks/config/admin/templates/bower.json',
|
||||
composer : './tasks/config/admin/templates/composer.json',
|
||||
package : './tasks/config/admin/templates/package.json',
|
||||
meteor : {
|
||||
css : './tasks/config/admin/templates/css-package.js',
|
||||
component : './tasks/config/admin/templates/component-package.js',
|
||||
less : './tasks/config/admin/templates/less-package.js',
|
||||
},
|
||||
readme : './tasks/config/admin/templates/README.md',
|
||||
notes : './RELEASE-NOTES.md'
|
||||
},
|
||||
|
||||
org : 'Semantic-Org',
|
||||
repo : 'Semantic-UI',
|
||||
|
||||
// files created for package managers
|
||||
files: {
|
||||
composer : 'composer.json',
|
||||
config : 'semantic.json',
|
||||
npm : 'package.json',
|
||||
meteor : 'package.js'
|
||||
},
|
||||
|
||||
// root name for distribution repos
|
||||
distRepoRoot : 'Semantic-UI-',
|
||||
|
||||
// root name for single component repos
|
||||
componentRepoRoot : 'UI-',
|
||||
|
||||
// root name for package managers
|
||||
packageRoot : 'semantic-ui-',
|
||||
|
||||
// root path to repos
|
||||
outputRoot : '../repos/',
|
||||
|
||||
homepage : 'http://www.semantic-ui.com',
|
||||
|
||||
// distributions that get separate repos
|
||||
distributions: [
|
||||
'LESS',
|
||||
'CSS'
|
||||
],
|
||||
|
||||
// components that get separate repositories for bower/npm
|
||||
components : [
|
||||
'accordion',
|
||||
'ad',
|
||||
'api',
|
||||
'breadcrumb',
|
||||
'button',
|
||||
'card',
|
||||
'checkbox',
|
||||
'comment',
|
||||
'dimmer',
|
||||
'divider',
|
||||
'dropdown',
|
||||
'feed',
|
||||
'flag',
|
||||
'form',
|
||||
'grid',
|
||||
'header',
|
||||
'icon',
|
||||
'image',
|
||||
'input',
|
||||
'item',
|
||||
'label',
|
||||
'list',
|
||||
'loader',
|
||||
'menu',
|
||||
'message',
|
||||
'modal',
|
||||
'nag',
|
||||
'popup',
|
||||
'progress',
|
||||
'rail',
|
||||
'rating',
|
||||
'reset',
|
||||
'reveal',
|
||||
'search',
|
||||
'segment',
|
||||
'shape',
|
||||
'sidebar',
|
||||
'site',
|
||||
'statistic',
|
||||
'step',
|
||||
'sticky',
|
||||
'tab',
|
||||
'table',
|
||||
'transition',
|
||||
'video',
|
||||
'visibility'
|
||||
]
|
||||
};
|
29
web/semantic/tasks/config/admin/templates/README.md
Normal file
29
web/semantic/tasks/config/admin/templates/README.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Semantic {Component}
|
||||
|
||||
This repository contains pre-compiled {component} files using the default themes. This is intended for use in projects that do not need all the bells and whistles of Semantic UI, and want to keep file size to a minimum.
|
||||
|
||||
For the latest changes please see the [Release Notes](https://github.com/Semantic-Org/UI-{Component}/blob/master/RELEASE-NOTES.md)
|
||||
|
||||
If you're looking for the full version of Semantic including all components and build tools [check out the main project repository](https://github.com/Semantic-Org/Semantic-UI/tree/1.0)
|
||||
|
||||
#### To install with Bower
|
||||
```
|
||||
bower install semantic-ui-{component}
|
||||
```
|
||||
|
||||
#### To install with NPM
|
||||
```
|
||||
npm install semantic-ui-{component}
|
||||
```
|
||||
|
||||
#### To install with Meteor
|
||||
```
|
||||
meteor add semantic:ui-{component}
|
||||
```
|
||||
|
||||
|
||||
## Addendum
|
||||
|
||||
This element's definitions (required class names, html structures) are available in the [UI Docs](http://www.semantic-ui.com)
|
||||
|
||||
Please consider checking out [all the benefits to theming](http://www.learnsemantic.com/guide/expert.html) before using these stand-alone releases.
|
29
web/semantic/tasks/config/admin/templates/bower.json
Normal file
29
web/semantic/tasks/config/admin/templates/bower.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name" : "Component",
|
||||
"description" : "Component distribution",
|
||||
"homepage" : "http://www.semantic-ui.com",
|
||||
"author": {
|
||||
"name" : "Jack Lukic",
|
||||
"web" : "http://www.jacklukic.com"
|
||||
},
|
||||
"ignore": [
|
||||
"./index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"semantic",
|
||||
"ui",
|
||||
"css3",
|
||||
"framework"
|
||||
],
|
||||
"license" : [
|
||||
"http://semantic-ui.mit-license.org/"
|
||||
],
|
||||
"ignore": [
|
||||
"docs",
|
||||
"node",
|
||||
"server",
|
||||
"spec",
|
||||
"src",
|
||||
"test"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
Package.describe({
|
||||
name : 'semantic:ui-{component}',
|
||||
summary : 'Semantic UI - {Component}: Single component release',
|
||||
version : '{version}',
|
||||
git : 'git://github.com/Semantic-Org/UI-{Component}.git',
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom('1.0');
|
||||
api.addFiles([
|
||||
{files}
|
||||
], 'client');
|
||||
});
|
20
web/semantic/tasks/config/admin/templates/composer.json
Normal file
20
web/semantic/tasks/config/admin/templates/composer.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name" : "semantic/ui",
|
||||
"description" : "Semantic empowers designers and developers by creating a shared vocabulary for UI.",
|
||||
"homepage" : "http://www.semantic-ui.com",
|
||||
"authors": [
|
||||
{
|
||||
"name" : "Jack Lukic",
|
||||
"email": "jacklukic@gmail.com",
|
||||
"web" : "http://www.jacklukic.com",
|
||||
"role" : "Creator"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"semantic",
|
||||
"ui",
|
||||
"css",
|
||||
"framework"
|
||||
],
|
||||
"license" : "MIT"
|
||||
}
|
33
web/semantic/tasks/config/admin/templates/css-package.js
Normal file
33
web/semantic/tasks/config/admin/templates/css-package.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
var
|
||||
where = 'client' // Adds files only to the client
|
||||
;
|
||||
|
||||
Package.describe({
|
||||
name : 'semantic:ui-css',
|
||||
summary : 'Semantic UI - CSS Release of Semantic UI',
|
||||
version : '{version}',
|
||||
git : 'git://github.com/Semantic-Org/Semantic-UI-CSS.git',
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
|
||||
api.versionsFrom('1.0');
|
||||
|
||||
api.addFiles([
|
||||
// icons
|
||||
'themes/default/assets/fonts/icons.eot',
|
||||
'themes/default/assets/fonts/icons.otf',
|
||||
'themes/default/assets/fonts/icons.svg',
|
||||
'themes/default/assets/fonts/icons.ttf',
|
||||
'themes/default/assets/fonts/icons.woff',
|
||||
'themes/default/assets/fonts/icons.woff2',
|
||||
|
||||
// flags
|
||||
'themes/default/assets/images/flags.png',
|
||||
|
||||
// release
|
||||
'semantic.css',
|
||||
'semantic.js'
|
||||
], 'client');
|
||||
|
||||
});
|
21
web/semantic/tasks/config/admin/templates/less-package.js
Normal file
21
web/semantic/tasks/config/admin/templates/less-package.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
var
|
||||
where = 'client' // Adds files only to the client
|
||||
;
|
||||
|
||||
Package.describe({
|
||||
name : 'semantic:ui',
|
||||
summary : 'Semantic UI - LESS Release of Semantic UI',
|
||||
version : '{version}',
|
||||
git : 'git://github.com/Semantic-Org/Semantic-UI-LESS.git',
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
|
||||
api.versionsFrom('1.0');
|
||||
api.use('less', 'client');
|
||||
|
||||
api.addFiles([
|
||||
{files}
|
||||
], 'client');
|
||||
|
||||
});
|
17
web/semantic/tasks/config/admin/templates/package.json
Normal file
17
web/semantic/tasks/config/admin/templates/package.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "semantic",
|
||||
"version": "1.0.0",
|
||||
"title": "Semantic UI",
|
||||
"description": "Semantic empowers designers and developers by creating a shared vocabulary for UI.",
|
||||
"homepage": "http://www.semantic-ui.com",
|
||||
"author": "Jack Lukic <jack@semantic-ui.com>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Semantic-Org/Semantic-UI.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Semantic-Org/Semantic-UI/issues"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
116
web/semantic/tasks/config/defaults.js
Normal file
116
web/semantic/tasks/config/defaults.js
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*******************************
|
||||
Default Paths
|
||||
*******************************/
|
||||
|
||||
module.exports = {
|
||||
|
||||
// base path added to all other paths
|
||||
base : '',
|
||||
|
||||
// base path when installed with npm
|
||||
pmRoot: 'semantic/',
|
||||
|
||||
// octal permission for output files, i.e. 644 (false does not adjust)
|
||||
permission : 744,
|
||||
|
||||
// whether to generate rtl files
|
||||
rtl : false,
|
||||
|
||||
// file paths
|
||||
files: {
|
||||
config : 'semantic.json',
|
||||
site : 'src/site',
|
||||
theme : 'src/theme.config'
|
||||
},
|
||||
|
||||
// folder paths
|
||||
paths: {
|
||||
source: {
|
||||
config : 'src/theme.config',
|
||||
definitions : 'src/definitions/',
|
||||
site : 'src/site/',
|
||||
themes : 'src/themes/'
|
||||
},
|
||||
output: {
|
||||
packaged : 'dist/',
|
||||
uncompressed : 'dist/components/',
|
||||
compressed : 'dist/components/',
|
||||
themes : 'dist/themes/'
|
||||
},
|
||||
clean : 'dist/'
|
||||
},
|
||||
|
||||
// components to include in package
|
||||
components: [
|
||||
|
||||
// global
|
||||
'reset',
|
||||
'site',
|
||||
|
||||
// elements
|
||||
'button',
|
||||
'divider',
|
||||
'flag',
|
||||
'header',
|
||||
'icon',
|
||||
'image',
|
||||
'input',
|
||||
'label',
|
||||
'list',
|
||||
'loader',
|
||||
'rail',
|
||||
'reveal',
|
||||
'segment',
|
||||
'step',
|
||||
|
||||
// collections
|
||||
'breadcrumb',
|
||||
'form',
|
||||
'grid',
|
||||
'menu',
|
||||
'message',
|
||||
'table',
|
||||
|
||||
// views
|
||||
'ad',
|
||||
'card',
|
||||
'comment',
|
||||
'feed',
|
||||
'item',
|
||||
'statistic',
|
||||
|
||||
// modules
|
||||
'accordion',
|
||||
'checkbox',
|
||||
'dimmer',
|
||||
'dropdown',
|
||||
'modal',
|
||||
'nag',
|
||||
'popup',
|
||||
'progress',
|
||||
'rating',
|
||||
'search',
|
||||
'shape',
|
||||
'sidebar',
|
||||
'sticky',
|
||||
'tab',
|
||||
'transition',
|
||||
'video',
|
||||
|
||||
// behaviors
|
||||
'api',
|
||||
'form',
|
||||
'state',
|
||||
'visibility'
|
||||
],
|
||||
|
||||
// whether to load admin tasks
|
||||
admin: false,
|
||||
|
||||
// globs used for matching file patterns
|
||||
globs : {
|
||||
ignored : '!(*.min|*.map|*.rtl)',
|
||||
ignoredRTL : '!(*.min|*.map)'
|
||||
}
|
||||
|
||||
};
|
24
web/semantic/tasks/config/docs.js
Normal file
24
web/semantic/tasks/config/docs.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*******************************
|
||||
Docs
|
||||
*******************************/
|
||||
|
||||
/* Paths used for "serve-docs" and "build-docs" tasks */
|
||||
module.exports = {
|
||||
base: '',
|
||||
paths: {
|
||||
source: {
|
||||
config : 'src/theme.config',
|
||||
definitions : 'src/definitions/',
|
||||
site : 'src/site/',
|
||||
themes : 'src/themes/'
|
||||
},
|
||||
output: {
|
||||
less : '../docs/out/src/',
|
||||
packaged : '../docs/out/dist/',
|
||||
uncompressed : '../docs/out/dist/components/',
|
||||
compressed : '../docs/out/dist/components/',
|
||||
themes : '../docs/out/dist/themes/'
|
||||
},
|
||||
clean: '../docs/out/dist/'
|
||||
}
|
||||
};
|
59
web/semantic/tasks/config/npm/gulpfile.js
Normal file
59
web/semantic/tasks/config/npm/gulpfile.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*******************************
|
||||
Set-up
|
||||
*******************************/
|
||||
|
||||
var
|
||||
gulp = require('gulp-help')(require('gulp')),
|
||||
|
||||
// read user config to know what task to load
|
||||
config = require('./tasks/config/user'),
|
||||
|
||||
// import tasks
|
||||
build = require('./tasks/build'),
|
||||
clean = require('./tasks/clean'),
|
||||
version = require('./tasks/version'),
|
||||
watch = require('./tasks/watch'),
|
||||
|
||||
// docs tasks
|
||||
serveDocs = require('./tasks/docs/serve'),
|
||||
buildDocs = require('./tasks/docs/build'),
|
||||
|
||||
// rtl
|
||||
buildRTL = require('./tasks/rtl/build'),
|
||||
watchRTL = require('./tasks/rtl/watch')
|
||||
;
|
||||
|
||||
/*--------------
|
||||
Common
|
||||
---------------*/
|
||||
|
||||
gulp.task('default', false, [
|
||||
'watch'
|
||||
]);
|
||||
|
||||
gulp.task('watch', 'Watch for site/theme changes', watch);
|
||||
gulp.task('build', 'Builds all files from source', build);
|
||||
|
||||
gulp.task('clean', 'Clean dist folder', clean);
|
||||
gulp.task('version', 'Displays current version of Semantic', version);
|
||||
|
||||
/*--------------
|
||||
Docs
|
||||
---------------*/
|
||||
|
||||
/*
|
||||
See usage instruction in Docs Readme
|
||||
https://github.com/Semantic-Org/Semantic-UI-Docs/
|
||||
*/
|
||||
|
||||
gulp.task('serve-docs', 'Serve file changes to SUI Docs', serveDocs);
|
||||
gulp.task('build-docs', 'Build all files and add to SUI Docs', buildDocs);
|
||||
|
||||
/*--------------
|
||||
RTL
|
||||
---------------*/
|
||||
|
||||
if(config.rtl) {
|
||||
gulp.task('watch-rtl', 'Build all files as RTL', watchRTL);
|
||||
gulp.task('build-rtl', 'Watch files as RTL ', buildRTL);
|
||||
}
|
135
web/semantic/tasks/config/project/config.js
Normal file
135
web/semantic/tasks/config/project/config.js
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*******************************
|
||||
Set-up
|
||||
*******************************/
|
||||
|
||||
var
|
||||
extend = require('extend'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
|
||||
defaults = require('../defaults')
|
||||
;
|
||||
|
||||
|
||||
/*******************************
|
||||
Exports
|
||||
*******************************/
|
||||
|
||||
module.exports = {
|
||||
|
||||
getPath: function(file, directory) {
|
||||
var
|
||||
configPath,
|
||||
walk = function(directory) {
|
||||
var
|
||||
nextDirectory = path.resolve( path.join(directory, path.sep, '..') ),
|
||||
currentPath = path.normalize( path.join(directory, file) )
|
||||
;
|
||||
if( fs.existsSync(currentPath) ) {
|
||||
// found file
|
||||
configPath = path.normalize(directory);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// reached file system root, let's stop
|
||||
if(nextDirectory == directory) {
|
||||
return;
|
||||
}
|
||||
// otherwise recurse
|
||||
walk(nextDirectory, file);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
// start walk from outside require-dot-files directory
|
||||
file = file || defaults.files.config;
|
||||
directory = directory || path.join(__dirname, path.sep, '..');
|
||||
walk(directory);
|
||||
return configPath || '';
|
||||
},
|
||||
|
||||
// adds additional derived values to a config object
|
||||
addDerivedValues: function(config) {
|
||||
|
||||
config = config || extend(false, {}, defaults);
|
||||
|
||||
/*--------------
|
||||
File Paths
|
||||
---------------*/
|
||||
|
||||
var
|
||||
configPath = this.getPath(),
|
||||
sourcePaths = {},
|
||||
outputPaths = {},
|
||||
folder
|
||||
;
|
||||
|
||||
// resolve paths (config location + base + path)
|
||||
for(folder in config.paths.source) {
|
||||
if(config.paths.source.hasOwnProperty(folder)) {
|
||||
sourcePaths[folder] = path.resolve(path.join(configPath, config.base, config.paths.source[folder]));
|
||||
}
|
||||
}
|
||||
for(folder in config.paths.output) {
|
||||
if(config.paths.output.hasOwnProperty(folder)) {
|
||||
outputPaths[folder] = path.resolve(path.join(configPath, config.base, config.paths.output[folder]));
|
||||
}
|
||||
}
|
||||
|
||||
// set config paths to full paths
|
||||
config.paths.source = sourcePaths;
|
||||
config.paths.output = outputPaths;
|
||||
|
||||
// resolve "clean" command path
|
||||
config.paths.clean = path.resolve( path.join(configPath, config.base, config.paths.clean) );
|
||||
|
||||
/*--------------
|
||||
CSS URLs
|
||||
---------------*/
|
||||
|
||||
// determine asset paths in css by finding relative path between themes and output
|
||||
// force forward slashes
|
||||
|
||||
config.paths.assets = {
|
||||
source : '../../themes', // source asset path is always the same
|
||||
uncompressed : path.relative(config.paths.output.uncompressed, config.paths.output.themes).replace(/\\/g,'/'),
|
||||
compressed : path.relative(config.paths.output.compressed, config.paths.output.themes).replace(/\\/g,'/'),
|
||||
packaged : path.relative(config.paths.output.packaged, config.paths.output.themes).replace(/\\/g,'/')
|
||||
};
|
||||
|
||||
|
||||
/*--------------
|
||||
Permission
|
||||
---------------*/
|
||||
|
||||
if(config.permission) {
|
||||
config.hasPermissions = true;
|
||||
}
|
||||
else {
|
||||
// pass blank object to avoid causing errors
|
||||
config.permission = {};
|
||||
config.hasPermissions = false;
|
||||
}
|
||||
|
||||
/*--------------
|
||||
Globs
|
||||
---------------*/
|
||||
|
||||
if(!config.globs) {
|
||||
config.globs = {};
|
||||
}
|
||||
|
||||
// takes component object and creates file glob matching selected components
|
||||
config.globs.components = (typeof config.components == 'object')
|
||||
? (config.components.length > 1)
|
||||
? '{' + config.components.join(',') + '}'
|
||||
: config.components[0]
|
||||
: '{' + defaults.components.join(',') + '}'
|
||||
;
|
||||
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
762
web/semantic/tasks/config/project/install.js
Normal file
762
web/semantic/tasks/config/project/install.js
Normal file
|
@ -0,0 +1,762 @@
|
|||
/*******************************
|
||||
Set-up
|
||||
*******************************/
|
||||
|
||||
var
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
defaults = require('../defaults'),
|
||||
release = require('./release'),
|
||||
|
||||
requireDotFile = require('require-dot-file')
|
||||
;
|
||||
|
||||
/*******************************
|
||||
When to Ask
|
||||
*******************************/
|
||||
|
||||
/* Preconditions for install questions */
|
||||
|
||||
var when = {
|
||||
|
||||
// path
|
||||
changeRoot: function(questions) {
|
||||
return (questions.useRoot !== undefined && questions.useRoot !== true);
|
||||
},
|
||||
|
||||
// permissions
|
||||
changePermissions: function(questions) {
|
||||
return (questions.changePermissions && questions.changePermissions === true);
|
||||
},
|
||||
|
||||
// install
|
||||
hasConfig: function() {
|
||||
return requireDotFile('semantic.json');
|
||||
},
|
||||
|
||||
allowOverwrite: function(questions) {
|
||||
return (questions.overwrite === undefined || questions.overwrite == 'yes');
|
||||
},
|
||||
notAuto: function(questions) {
|
||||
return (questions.install !== 'auto' && (questions.overwrite === undefined || questions.overwrite == 'yes'));
|
||||
},
|
||||
custom: function(questions) {
|
||||
return (questions.install === 'custom' && (questions.overwrite === undefined || questions.overwrite == 'yes'));
|
||||
},
|
||||
express: function(questions) {
|
||||
return (questions.install === 'express' && (questions.overwrite === undefined || questions.overwrite == 'yes'));
|
||||
},
|
||||
|
||||
// customize
|
||||
customize: function(questions) {
|
||||
return (questions.customize === true);
|
||||
},
|
||||
primaryColor: function(questions) {
|
||||
return (questions.primaryColor);
|
||||
},
|
||||
secondaryColor: function(questions) {
|
||||
return (questions.secondaryColor);
|
||||
}
|
||||
};
|
||||
|
||||
/*******************************
|
||||
Response Filters
|
||||
*******************************/
|
||||
|
||||
/* Filters to user input from install questions */
|
||||
|
||||
var filter = {
|
||||
removeTrailingSlash: function(path) {
|
||||
return path.replace(/(\/$|\\$)+/mg, '');
|
||||
}
|
||||
};
|
||||
|
||||
/*******************************
|
||||
Configuration
|
||||
*******************************/
|
||||
|
||||
module.exports = {
|
||||
|
||||
// check whether install is setup
|
||||
isSetup: function() {
|
||||
return when.hasConfig();
|
||||
},
|
||||
|
||||
// checks if files are in a PM directory
|
||||
getPackageManager: function(directory) {
|
||||
var
|
||||
// returns last matching result (avoid sub-module detection)
|
||||
walk = function(directory) {
|
||||
var
|
||||
pathArray = directory.split(path.sep),
|
||||
folder = pathArray[pathArray.length - 1],
|
||||
nextDirectory = path.join(directory, path.sep, '..')
|
||||
;
|
||||
console.log(folder, nextDirectory);
|
||||
if( folder == 'bower_components') {
|
||||
return {
|
||||
name: 'Bower',
|
||||
root: nextDirectory
|
||||
};
|
||||
}
|
||||
else if(folder == 'node_modules') {
|
||||
return {
|
||||
name: 'NPM',
|
||||
root: nextDirectory
|
||||
};
|
||||
}
|
||||
else if(folder == 'composer') {
|
||||
return {
|
||||
name: 'Composer',
|
||||
root: nextDirectory
|
||||
};
|
||||
}
|
||||
if(path.resolve(directory) == path.resolve(nextDirectory)) {
|
||||
return false;
|
||||
}
|
||||
// recurse downward
|
||||
return walk(nextDirectory);
|
||||
}
|
||||
;
|
||||
// start walk from current directory if none specified
|
||||
directory = directory || (__dirname + path.sep);
|
||||
return walk(directory);
|
||||
},
|
||||
|
||||
// checks if files is PMed submodule
|
||||
isSubModule: function(directory) {
|
||||
var
|
||||
moduleFolders = 0,
|
||||
walk = function(directory) {
|
||||
var
|
||||
pathArray = directory.split(path.sep),
|
||||
folder = pathArray[pathArray.length - 2],
|
||||
nextDirectory = path.join(directory, path.sep, '..')
|
||||
;
|
||||
if( folder == 'bower_components') {
|
||||
moduleFolders++;
|
||||
}
|
||||
else if(folder == 'node_modules') {
|
||||
moduleFolders++;
|
||||
}
|
||||
else if(folder == 'composer') {
|
||||
moduleFolders++;
|
||||
}
|
||||
if(path.resolve(directory) == path.resolve(nextDirectory)) {
|
||||
return (moduleFolders > 1);
|
||||
}
|
||||
// recurse downward
|
||||
return walk(nextDirectory);
|
||||
}
|
||||
;
|
||||
// start walk from current directory if none specified
|
||||
directory = directory || (__dirname + path.sep);
|
||||
return walk(directory);
|
||||
},
|
||||
|
||||
|
||||
createJSON: function(answers) {
|
||||
var
|
||||
json = {
|
||||
paths: {
|
||||
source: {},
|
||||
output: {}
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
// add components
|
||||
if(answers.components) {
|
||||
json.components = answers.components;
|
||||
}
|
||||
|
||||
// add rtl choice
|
||||
if(answers.rtl) {
|
||||
json.rtl = answers.rtl;
|
||||
}
|
||||
|
||||
// add permissions
|
||||
if(answers.permission) {
|
||||
json.permission = answers.permission;
|
||||
}
|
||||
|
||||
// add path to semantic
|
||||
if(answers.semanticRoot) {
|
||||
json.base = path.normalize(answers.semanticRoot);
|
||||
}
|
||||
|
||||
// record version number to avoid re-installing on same version
|
||||
json.version = release.version;
|
||||
|
||||
// add dist folder paths
|
||||
if(answers.dist) {
|
||||
answers.dist = path.normalize(answers.dist);
|
||||
|
||||
json.paths.output = {
|
||||
packaged : path.normalize(answers.dist + '/'),
|
||||
uncompressed : path.normalize(answers.dist + '/components/'),
|
||||
compressed : path.normalize(answers.dist + '/components/'),
|
||||
themes : path.normalize(answers.dist + '/themes/')
|
||||
};
|
||||
}
|
||||
|
||||
// add site path
|
||||
if(answers.site) {
|
||||
json.paths.source.site = path.normalize(answers.site + '/');
|
||||
}
|
||||
if(answers.packaged) {
|
||||
json.paths.output.packaged = path.normalize(answers.packaged + '/');
|
||||
}
|
||||
if(answers.compressed) {
|
||||
json.paths.output.compressed = path.normalize(answers.compressed + '/');
|
||||
}
|
||||
if(answers.uncompressed) {
|
||||
json.paths.output.uncompressed = path.normalize(answers.uncompressed + '/');
|
||||
}
|
||||
return json;
|
||||
},
|
||||
|
||||
// files cleaned up after install
|
||||
setupFiles: [
|
||||
'./src/theme.config.example',
|
||||
'./semantic.json.example',
|
||||
'./src/_site'
|
||||
],
|
||||
|
||||
regExp: {
|
||||
// used to match siteFolder variable in theme.less
|
||||
siteVariable: /@siteFolder .*\'(.*)/mg
|
||||
},
|
||||
|
||||
// source paths (relative to tasks/install.js )
|
||||
source: {
|
||||
config : './semantic.json.example',
|
||||
definitions : './src/definitions',
|
||||
gulpFile : './gulpfile.js',
|
||||
lessImport : './src/semantic.less',
|
||||
site : './src/_site',
|
||||
tasks : './tasks',
|
||||
themeConfig : './src/theme.config.example',
|
||||
themeImport : './src/theme.less',
|
||||
themes : './src/themes',
|
||||
userGulpFile : './tasks/config/npm/gulpfile.js'
|
||||
},
|
||||
|
||||
// expected final filenames
|
||||
files: {
|
||||
config : 'semantic.json',
|
||||
lessImport : 'src/semantic.less',
|
||||
site : 'src/site',
|
||||
themeConfig : 'src/theme.config',
|
||||
themeImport : 'src/theme.less'
|
||||
},
|
||||
|
||||
// folder paths to files relative to root
|
||||
folders: {
|
||||
config : './',
|
||||
definitions : 'src/definitions/',
|
||||
lessImport : 'src/',
|
||||
modules : 'node_modules/',
|
||||
site : 'src/site/',
|
||||
tasks : 'tasks/',
|
||||
themeConfig : 'src/',
|
||||
themeImport : 'src/',
|
||||
themes : 'src/themes/'
|
||||
},
|
||||
|
||||
// questions asked during install
|
||||
questions: {
|
||||
|
||||
root: [
|
||||
{
|
||||
type : 'list',
|
||||
name : 'useRoot',
|
||||
message :
|
||||
' \n' +
|
||||
' {packageMessage} \n' +
|
||||
' \n' +
|
||||
' Is this your project folder?\n' +
|
||||
' \033[92m{root}\033[0m \n' +
|
||||
' \n ' +
|
||||
'\n',
|
||||
choices: [
|
||||
{
|
||||
name : 'Yes',
|
||||
value : true
|
||||
},
|
||||
{
|
||||
name : 'No, let me specify',
|
||||
value : false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type : 'input',
|
||||
name : 'customRoot',
|
||||
message : 'Please enter the absolute path to your project root',
|
||||
default : '/my/project/path',
|
||||
when : when.changeRoot
|
||||
},
|
||||
{
|
||||
type : 'input',
|
||||
name : 'semanticRoot',
|
||||
message : 'Where should we put Semantic UI inside your project?',
|
||||
default : 'semantic/'
|
||||
}
|
||||
],
|
||||
|
||||
setup: [
|
||||
{
|
||||
type: 'list',
|
||||
name: 'overwrite',
|
||||
message: 'It looks like you have a semantic.json file already.',
|
||||
when: when.hasConfig,
|
||||
choices: [
|
||||
{
|
||||
name: 'Yes, extend my current settings.',
|
||||
value: 'yes'
|
||||
},
|
||||
{
|
||||
name: 'Skip install',
|
||||
value: 'no'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'install',
|
||||
message: 'Set-up Semantic UI',
|
||||
when: when.allowOverwrite,
|
||||
choices: [
|
||||
{
|
||||
name: 'Automatic (Use defaults locations and all components)',
|
||||
value: 'auto'
|
||||
},
|
||||
{
|
||||
name: 'Express (Set components and output folder)',
|
||||
value: 'express'
|
||||
},
|
||||
{
|
||||
name: 'Custom (Customize all src/dist values)',
|
||||
value: 'custom'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'components',
|
||||
message: 'What components should we include in the package?',
|
||||
|
||||
// duplicated manually from tasks/defaults.js with additional property
|
||||
choices: [
|
||||
{ name: "reset", checked: true },
|
||||
{ name: "site", checked: true },
|
||||
{ name: "button", checked: true },
|
||||
{ name: "divider", checked: true },
|
||||
{ name: "flag", checked: true },
|
||||
{ name: "header", checked: true },
|
||||
{ name: "icon", checked: true },
|
||||
{ name: "image", checked: true },
|
||||
{ name: "input", checked: true },
|
||||
{ name: "label", checked: true },
|
||||
{ name: "list", checked: true },
|
||||
{ name: "loader", checked: true },
|
||||
{ name: "rail", checked: true },
|
||||
{ name: "reveal", checked: true },
|
||||
{ name: "segment", checked: true },
|
||||
{ name: "step", checked: true },
|
||||
{ name: "breadcrumb", checked: true },
|
||||
{ name: "form", checked: true },
|
||||
{ name: "grid", checked: true },
|
||||
{ name: "menu", checked: true },
|
||||
{ name: "message", checked: true },
|
||||
{ name: "table", checked: true },
|
||||
{ name: "ad", checked: true },
|
||||
{ name: "card", checked: true },
|
||||
{ name: "comment", checked: true },
|
||||
{ name: "feed", checked: true },
|
||||
{ name: "item", checked: true },
|
||||
{ name: "statistic", checked: true },
|
||||
{ name: "accordion", checked: true },
|
||||
{ name: "checkbox", checked: true },
|
||||
{ name: "dimmer", checked: true },
|
||||
{ name: "dropdown", checked: true },
|
||||
{ name: "modal", checked: true },
|
||||
{ name: "nag", checked: true },
|
||||
{ name: "popup", checked: true },
|
||||
{ name: "progress", checked: true },
|
||||
{ name: "rating", checked: true },
|
||||
{ name: "search", checked: true },
|
||||
{ name: "shape", checked: true },
|
||||
{ name: "sidebar", checked: true },
|
||||
{ name: "sticky", checked: true },
|
||||
{ name: "tab", checked: true },
|
||||
{ name: "transition", checked: true },
|
||||
{ name: "video", checked: true },
|
||||
{ name: "api", checked: true },
|
||||
{ name: "form", checked: true },
|
||||
{ name: "state", checked: true },
|
||||
{ name: "visibility", checked: true }
|
||||
],
|
||||
when: when.notAuto
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'changePermisions',
|
||||
when: when.notAuto,
|
||||
message: 'Should we set permissions on outputted files?',
|
||||
choices: [
|
||||
{
|
||||
name: 'No',
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: 'Yes',
|
||||
value: true
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'permission',
|
||||
message: 'What octal file permission should outputted files receive?',
|
||||
default: defaults.permission,
|
||||
when: when.changePermissions
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'rtl',
|
||||
message: 'Do you use a RTL (Right-To-Left) language?',
|
||||
when: when.notAuto,
|
||||
choices: [
|
||||
{
|
||||
name: 'No',
|
||||
value: false
|
||||
},
|
||||
{
|
||||
name: 'Yes',
|
||||
value: true
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'dist',
|
||||
message: 'Where should we output Semantic UI?',
|
||||
default: defaults.paths.output.packaged,
|
||||
filter: filter.removeTrailingSlash,
|
||||
when: when.express
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'site',
|
||||
message: 'Where should we put your site folder?',
|
||||
default: defaults.paths.source.site,
|
||||
filter: filter.removeTrailingSlash,
|
||||
when: when.custom
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'packaged',
|
||||
message: 'Where should we output a packaged version?',
|
||||
default: defaults.paths.output.packaged,
|
||||
filter: filter.removeTrailingSlash,
|
||||
when: when.custom
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'compressed',
|
||||
message: 'Where should we output compressed components?',
|
||||
default: defaults.paths.output.compressed,
|
||||
filter: filter.removeTrailingSlash,
|
||||
when: when.custom
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'uncompressed',
|
||||
message: 'Where should we output uncompressed components?',
|
||||
default: defaults.paths.output.uncompressed,
|
||||
filter: filter.removeTrailingSlash,
|
||||
when: when.custom
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
cleanup: [
|
||||
{
|
||||
type: 'list',
|
||||
name: 'cleanup',
|
||||
message: 'Should we remove set-up files?',
|
||||
choices: [
|
||||
{
|
||||
name: 'Yes (re-install will require redownloading semantic).',
|
||||
value: 'yes'
|
||||
},
|
||||
{
|
||||
name: 'No Thanks',
|
||||
value: 'no'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'build',
|
||||
message: 'Do you want to build Semantic now?',
|
||||
choices: [
|
||||
{
|
||||
name: 'Yes',
|
||||
value: 'yes'
|
||||
},
|
||||
{
|
||||
name: 'No',
|
||||
value: 'no'
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
site: [
|
||||
{
|
||||
type: 'list',
|
||||
name: 'customize',
|
||||
message: 'You have not yet customized your site, can we help you do that?',
|
||||
choices: [
|
||||
{
|
||||
name: 'Yes, ask me a few questions',
|
||||
value: true
|
||||
},
|
||||
{
|
||||
name: 'No I\'ll do it myself',
|
||||
value: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'headerFont',
|
||||
message: 'Select your header font',
|
||||
choices: [
|
||||
{
|
||||
name: 'Helvetica Neue, Arial, sans-serif',
|
||||
value: 'Helvetica Neue, Arial, sans-serif;'
|
||||
},
|
||||
{
|
||||
name: 'Lato (Google Fonts)',
|
||||
value: 'Lato'
|
||||
},
|
||||
{
|
||||
name: 'Open Sans (Google Fonts)',
|
||||
value: 'Open Sans'
|
||||
},
|
||||
{
|
||||
name: 'Source Sans Pro (Google Fonts)',
|
||||
value: 'Source Sans Pro'
|
||||
},
|
||||
{
|
||||
name: 'Droid (Google Fonts)',
|
||||
value: 'Droid'
|
||||
},
|
||||
{
|
||||
name: 'I\'ll choose on my own',
|
||||
value: false
|
||||
}
|
||||
],
|
||||
when: when.customize
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'pageFont',
|
||||
message: 'Select your page font',
|
||||
choices: [
|
||||
{
|
||||
name: 'Helvetica Neue, Arial, sans-serif',
|
||||
value: 'Helvetica Neue, Arial, sans-serif;'
|
||||
},
|
||||
{
|
||||
name: 'Lato (Import from Google Fonts)',
|
||||
value: 'Lato'
|
||||
},
|
||||
{
|
||||
name: 'Open Sans (Import from Google Fonts)',
|
||||
value: 'Open Sans'
|
||||
},
|
||||
{
|
||||
name: 'Source Sans Pro (Import from Google Fonts)',
|
||||
value: 'Source Sans Pro'
|
||||
},
|
||||
{
|
||||
name: 'Droid (Google Fonts)',
|
||||
value: 'Droid'
|
||||
},
|
||||
{
|
||||
name: 'I\'ll choose on my own',
|
||||
value: false
|
||||
}
|
||||
],
|
||||
when: when.customize
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'fontSize',
|
||||
message: 'Select your base font size',
|
||||
default: '14px',
|
||||
choices: [
|
||||
{
|
||||
name: '12px',
|
||||
},
|
||||
{
|
||||
name: '13px',
|
||||
},
|
||||
{
|
||||
name: '14px (Recommended)',
|
||||
value: '14px'
|
||||
},
|
||||
{
|
||||
name: '15px',
|
||||
},
|
||||
{
|
||||
name: '16px',
|
||||
},
|
||||
{
|
||||
name: 'I\'ll choose on my own',
|
||||
value: false
|
||||
}
|
||||
],
|
||||
when: when.customize
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'primaryColor',
|
||||
message: 'Select the closest name for your primary brand color',
|
||||
default: '14px',
|
||||
choices: [
|
||||
{
|
||||
name: 'Blue'
|
||||
},
|
||||
{
|
||||
name: 'Green'
|
||||
},
|
||||
{
|
||||
name: 'Orange'
|
||||
},
|
||||
{
|
||||
name: 'Pink'
|
||||
},
|
||||
{
|
||||
name: 'Purple'
|
||||
},
|
||||
{
|
||||
name: 'Red'
|
||||
},
|
||||
{
|
||||
name: 'Teal'
|
||||
},
|
||||
{
|
||||
name: 'Yellow'
|
||||
},
|
||||
{
|
||||
name: 'Black'
|
||||
},
|
||||
{
|
||||
name: 'I\'ll choose on my own',
|
||||
value: false
|
||||
}
|
||||
],
|
||||
when: when.customize
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'PrimaryHex',
|
||||
message: 'Enter a hexcode for your primary brand color',
|
||||
when: when.primaryColor
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'secondaryColor',
|
||||
message: 'Select the closest name for your secondary brand color',
|
||||
default: '14px',
|
||||
choices: [
|
||||
{
|
||||
name: 'Blue'
|
||||
},
|
||||
{
|
||||
name: 'Green'
|
||||
},
|
||||
{
|
||||
name: 'Orange'
|
||||
},
|
||||
{
|
||||
name: 'Pink'
|
||||
},
|
||||
{
|
||||
name: 'Purple'
|
||||
},
|
||||
{
|
||||
name: 'Red'
|
||||
},
|
||||
{
|
||||
name: 'Teal'
|
||||
},
|
||||
{
|
||||
name: 'Yellow'
|
||||
},
|
||||
{
|
||||
name: 'Black'
|
||||
},
|
||||
{
|
||||
name: 'I\'ll choose on my own',
|
||||
value: false
|
||||
}
|
||||
],
|
||||
when: when.customize
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'secondaryHex',
|
||||
message: 'Enter a hexcode for your secondary brand color',
|
||||
when: when.secondaryColor
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
settings: {
|
||||
|
||||
/* Rename Files */
|
||||
rename: {
|
||||
json : { extname : '.json' },
|
||||
},
|
||||
|
||||
/* Copy Install Folders */
|
||||
wrench: {
|
||||
|
||||
// copy during npm update (default theme / definition)
|
||||
update: {
|
||||
forceDelete : true,
|
||||
excludeHiddenUnix : true,
|
||||
preserveFiles : false
|
||||
},
|
||||
|
||||
// copy during first npm install
|
||||
install: {
|
||||
forceDelete : true,
|
||||
excludeHiddenUnix : true,
|
||||
preserveFiles : false
|
||||
},
|
||||
|
||||
// copy for node_modules
|
||||
modules: {
|
||||
forceDelete : true,
|
||||
excludeHiddenUnix : true,
|
||||
preserveFiles : false
|
||||
},
|
||||
|
||||
// copy for site theme
|
||||
site: {
|
||||
forceDelete : false,
|
||||
excludeHiddenUnix : true,
|
||||
preserveFiles : true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
61
web/semantic/tasks/config/project/release.js
Normal file
61
web/semantic/tasks/config/project/release.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*******************************
|
||||
Release Config
|
||||
*******************************/
|
||||
|
||||
var
|
||||
requireDotFile = require('require-dot-file'),
|
||||
config,
|
||||
package,
|
||||
version
|
||||
;
|
||||
|
||||
|
||||
/*******************************
|
||||
Derived Values
|
||||
*******************************/
|
||||
|
||||
try {
|
||||
|
||||
config = requireDotFile('semantic.json');
|
||||
package = require('../../../package.json');
|
||||
|
||||
// looks for version in config or package.json (whichever is available)
|
||||
version = (config && config.version !== undefined)
|
||||
? config.version
|
||||
: package.version
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
catch(error) {
|
||||
// generate fake package
|
||||
package = {
|
||||
version: 'x.x'
|
||||
};
|
||||
}
|
||||
|
||||
/*******************************
|
||||
Export
|
||||
*******************************/
|
||||
|
||||
module.exports = {
|
||||
|
||||
title : 'Semantic UI',
|
||||
repository : 'https://github.com/Semantic-Org/Semantic-UI',
|
||||
url : 'http://www.semantic-ui.com/',
|
||||
|
||||
banner: ''
|
||||
+ ' /*' + '\n'
|
||||
+ ' * # <%= title %> - <%= version %>' + '\n'
|
||||
+ ' * <%= repository %>' + '\n'
|
||||
+ ' * <%= url %>' + '\n'
|
||||
+ ' *' + '\n'
|
||||
+ ' * Copyright 2014 Contributors' + '\n'
|
||||
+ ' * Released under the MIT license' + '\n'
|
||||
+ ' * http://opensource.org/licenses/MIT' + '\n'
|
||||
+ ' *' + '\n'
|
||||
+ ' */' + '\n',
|
||||
|
||||
version : package.version
|
||||
|
||||
};
|
127
web/semantic/tasks/config/project/tasks.js
Normal file
127
web/semantic/tasks/config/project/tasks.js
Normal file
|
@ -0,0 +1,127 @@
|
|||
var
|
||||
config = require('../user'),
|
||||
release = require('./release')
|
||||
;
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
banner : release.banner,
|
||||
|
||||
log: {
|
||||
created: function(file) {
|
||||
return 'Created: ' + file;
|
||||
},
|
||||
modified: function(file) {
|
||||
return 'Modified: ' + file;
|
||||
}
|
||||
},
|
||||
|
||||
filenames: {
|
||||
concatenatedCSS : 'semantic.css',
|
||||
concatenatedJS : 'semantic.js',
|
||||
concatenatedMinifiedCSS : 'semantic.min.css',
|
||||
concatenatedMinifiedJS : 'semantic.min.js',
|
||||
concatenatedRTLCSS : 'semantic.rtl.css',
|
||||
concatenatedMinifiedRTLCSS : 'semantic.rtl.min.css'
|
||||
},
|
||||
|
||||
regExp: {
|
||||
|
||||
comments: {
|
||||
|
||||
// remove all comments from config files (.variable)
|
||||
variables : {
|
||||
in : /(\/\*[\s\S]+?\*\/+)[\s\S]+?\/\* End Config \*\//,
|
||||
out : '$1',
|
||||
},
|
||||
|
||||
// add version to first comment
|
||||
license: {
|
||||
in : /(^\/\*[\s\S]+)(# Semantic UI )([\s\S]+?\*\/)/,
|
||||
out : '$1$2' + release.version + ' $3'
|
||||
},
|
||||
|
||||
// adds uniform spacing around comments
|
||||
large: {
|
||||
in : /(\/\*\*\*\*[\s\S]+?\*\/)/mg,
|
||||
out : '\n\n$1\n'
|
||||
},
|
||||
small: {
|
||||
in : /(\/\*---[\s\S]+?\*\/)/mg,
|
||||
out : '\n$1\n'
|
||||
},
|
||||
tiny: {
|
||||
in : /(\/\* [\s\S]+? \*\/)/mg,
|
||||
out : '\n$1'
|
||||
}
|
||||
},
|
||||
|
||||
theme: /.*\/themes\/.*?(?=\/)/mg
|
||||
|
||||
},
|
||||
|
||||
settings: {
|
||||
|
||||
/* Remove Files in Clean */
|
||||
del: {
|
||||
silent : true
|
||||
},
|
||||
|
||||
/* Comment Banners */
|
||||
header: {
|
||||
title : release.title,
|
||||
version : release.version,
|
||||
repository : release.repository,
|
||||
url : release.url
|
||||
},
|
||||
|
||||
/* What Browsers to Prefix */
|
||||
prefix: {
|
||||
browsers: [
|
||||
'last 2 version',
|
||||
'> 1%',
|
||||
'opera 12.1',
|
||||
'safari 6',
|
||||
'ie 9',
|
||||
'bb 10',
|
||||
'android 4'
|
||||
]
|
||||
},
|
||||
|
||||
/* File Renames */
|
||||
rename: {
|
||||
minJS : { extname : '.min.js' },
|
||||
minCSS : { extname : '.min.css' },
|
||||
rtlCSS : { extname : '.rtl.css' },
|
||||
rtlMinCSS : { extname : '.rtl.min.css' }
|
||||
},
|
||||
|
||||
/* Minified CSS Concat */
|
||||
minify: {
|
||||
processImport : false,
|
||||
restructuring : false,
|
||||
keepSpecialComments : 1
|
||||
},
|
||||
|
||||
/* Minified JS Settings */
|
||||
uglify: {
|
||||
mangle : true,
|
||||
preserveComments : 'some'
|
||||
},
|
||||
|
||||
/* Minified Concat CSS Settings */
|
||||
concatMinify: {
|
||||
processImport : false,
|
||||
restructuring : false,
|
||||
keepSpecialComments : false
|
||||
},
|
||||
|
||||
/* Minified Concat JS */
|
||||
concatUglify: {
|
||||
mangle : true,
|
||||
preserveComments : false
|
||||
}
|
||||
|
||||
}
|
||||
};
|
58
web/semantic/tasks/config/user.js
Normal file
58
web/semantic/tasks/config/user.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*******************************
|
||||
Set-up
|
||||
*******************************/
|
||||
|
||||
var
|
||||
// npm dependencies
|
||||
extend = require('extend'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
requireDotFile = require('require-dot-file'),
|
||||
|
||||
// semantic.json defaults
|
||||
defaults = require('./defaults'),
|
||||
config = require('./project/config'),
|
||||
|
||||
// Final config object
|
||||
gulpConfig = {},
|
||||
|
||||
// semantic.json settings
|
||||
userConfig
|
||||
|
||||
;
|
||||
|
||||
|
||||
/*******************************
|
||||
User Config
|
||||
*******************************/
|
||||
|
||||
try {
|
||||
// looks for config file across all parent directories
|
||||
userConfig = requireDotFile('semantic.json');
|
||||
}
|
||||
catch(error) {
|
||||
if(error.code === 'MODULE_NOT_FOUND') {
|
||||
console.error('No semantic.json config found');
|
||||
}
|
||||
}
|
||||
|
||||
// extend user config with defaults
|
||||
gulpConfig = (!userConfig)
|
||||
? extend(true, {}, defaults)
|
||||
: extend(false, {}, defaults, userConfig)
|
||||
;
|
||||
|
||||
/*******************************
|
||||
Add Derived Values
|
||||
*******************************/
|
||||
|
||||
// adds calculated values
|
||||
config.addDerivedValues(gulpConfig);
|
||||
|
||||
|
||||
/*******************************
|
||||
Export
|
||||
*******************************/
|
||||
|
||||
module.exports = gulpConfig;
|
||||
|
Reference in a new issue