diff --git a/.gitignore b/.gitignore index d25210f28..ec2b069a7 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ Thumbs.db nbproject *.sublime-project *.sublime-workspace +.build* diff --git a/README.md b/README.md index 3bf96a199..ebfd3f03a 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,14 @@ gulp help // list all commands For more detail into how work with Semantic when building a site please [read out customization guide](http://learnsemantic.com/developing/customizing.html) on [LearnSemantic.com](http://learnsemantic.com/) +## Meteor + +To use Semantic with the [Meteor.js](https://www.meteor.com) framework, run + +$ meteor add semantic:ui + +Learn more by reading the [Meteor integration README](https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md). + ## Browser Support @@ -100,4 +108,3 @@ When adding pull requests be sure to merge into [next](https://github.com/Semant If you'd like to start a conversation about Semantic feel free to reach out by e-mail [jack@semantic-ui.com](mailto:jack@semantic-ui.com) [![Flattr This](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=jlukic&url=https%3A%2F%2Fgithub.com%2Fjlukic%2FSemantic-UI) - diff --git a/gulpfile.js b/gulpfile.js index bc4e4b028..9cedf39a8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,61 +9,46 @@ var - gulp = require('gulp-help')(require('gulp')), + gulp = require('gulp-help')(require('gulp')), // node components & oddballs - console = require('better-console'), - del = require('del'), - extend = require('extend'), - fs = require('fs'), - path = require('path'), - runSequence = require('run-sequence'), - wrench = require('wrench'), - - // gulp dependencies - autoprefixer = require('gulp-autoprefixer'), - chmod = require('gulp-chmod'), - clone = require('gulp-clone'), - concat = require('gulp-concat'), - concatCSS = require('gulp-concat-css'), - copy = require('gulp-copy'), - debug = require('gulp-debug'), - flatten = require('gulp-flatten'), - header = require('gulp-header'), - jeditor = require('gulp-json-editor'), - karma = require('gulp-karma'), - less = require('gulp-less'), - minifyCSS = require('gulp-minify-css'), - notify = require('gulp-notify'), - plumber = require('gulp-plumber'), - print = require('gulp-print'), - prompt = require('gulp-prompt'), - rename = require('gulp-rename'), - replace = require('gulp-replace'), - rtlcss = require('gulp-rtlcss'), - sourcemaps = require('gulp-sourcemaps'), - uglify = require('gulp-uglify'), - util = require('gulp-util'), - watch = require('gulp-watch'), + console = require('better-console'), + del = require('del'), + extend = require('extend'), + fs = require('fs'), + + // unsure + path = require('path'), + + // watch / build deps + autoprefixer = require('gulp-autoprefixer'), + chmod = require('gulp-chmod'), + clone = require('gulp-clone'), + concat = require('gulp-concat'), + copy = require('gulp-copy'), + debug = require('gulp-debug'), + flatten = require('gulp-flatten'), + header = require('gulp-header'), + karma = require('gulp-karma'), + less = require('gulp-less'), + minifyCSS = require('gulp-minify-css'), + plumber = require('gulp-plumber'), + print = require('gulp-print'), + rename = require('gulp-rename'), + replace = require('gulp-replace'), + uglify = require('gulp-uglify'), + util = require('gulp-util'), + watch = require('gulp-watch'), + + // rtl + rtlcss = require('gulp-rtlcss'), // config - banner = require('./tasks/banner'), - comments = require('./tasks/comments'), - defaults = require('./tasks/defaults'), - log = require('./tasks/log'), - questions = require('./tasks/questions'), - settings = require('./tasks/gulp-settings'), - - // admin - release = require('./tasks/admin/release'), - git = require('gulp-git'), - githubAPI = require('github'), - - oAuth = fs.existsSync('./tasks/admin/oauth.js') - ? require('./tasks/admin/oauth') - : false, - github, - + banner = require('./tasks/banner'), + comments = require('./tasks/comments'), + defaults = require('./tasks/defaults'), + log = require('./tasks/log'), + settings = require('./tasks/gulp-settings'), // local runSetup = false, @@ -134,14 +119,6 @@ var : 'Unknown' ; - // create glob for matching filenames from components in semantic.json - componentGlob = (typeof config.components == 'object') - ? (config.components.length > 1) - ? '{' + config.components.join(',') + '}' - : config.components[0] - : '{' + defaults.components.join(',') + '}' - ; - // relative asset paths for css assetPaths = { uncompressed : path.relative(output.uncompressed, output.themes).replace(/\\/g,'/'), @@ -161,6 +138,15 @@ var } } clean = base + clean; + + // create glob for matching filenames from components in semantic.json + componentGlob = (typeof config.components == 'object') + ? (config.components.length > 1) + ? '{' + config.components.join(',') + '}' + : config.components[0] + : '{' + defaults.components.join(',') + '}' + ; + } ; @@ -245,7 +231,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb // unified css stream stream = gulp.src(srcPath) .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(replace(comments.variables.in, comments.variables.out)) .pipe(replace(comments.large.in, comments.large.out)) @@ -261,7 +246,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) @@ -277,7 +261,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) .pipe(rename(settings.rename.minCSS)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.compressed)) @@ -294,10 +277,10 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb }) ; - // watch for changes in assets + // watch for changes in assets that match component names (or their plural) gulp .watch([ - source.themes + '**/assets/**' + source.themes + '**/assets/**/' + componentGlob + '?(s).*' ], function(file) { // copy assets gulp.src(file.path, { base: source.themes }) @@ -318,7 +301,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(chmod(config.permission)) @@ -359,7 +341,7 @@ gulp.task('build', 'Builds all files from source', function(callback) { assetPaths.source = '../../themes'; // path.relative returns wrong path (hardcoded for src) // copy assets - gulp.src(source.themes + '**/assets/**') + gulp.src(source.themes + '**/assets/**/' + componentGlob + '?(s).*') .pipe(chmod(config.permission)) .pipe(gulp.dest(output.themes)) ; @@ -371,7 +353,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - // .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(header(banner, settings.header)) @@ -387,7 +368,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { // unified css stream stream = gulp.src(source.definitions + '**/' + componentGlob + '.less') .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(flatten()) .pipe(replace(comments.variables.in, comments.variables.out)) @@ -404,7 +384,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) @@ -420,7 +399,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) .pipe(rename(settings.rename.minCSS)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.compressed)) @@ -430,7 +408,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { gulp.start('package compressed css'); }) ; - }); // cleans distribution files @@ -442,11 +419,11 @@ gulp.task('version', 'Displays current version of Semantic', function(callback) console.log('Semantic UI ' + version); }); + /******************************* RTL Tasks *******************************/ - /* Watch RTL */ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(callback) { @@ -509,7 +486,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c // unified css stream stream = gulp.src(srcPath) .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(replace(comments.variables.in, comments.variables.out)) .pipe(replace(comments.large.in, comments.large.out)) @@ -526,7 +502,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(rename(settings.rename.rtlCSS)) @@ -542,7 +517,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c .pipe(clone()) .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(rename(settings.rename.rtlMinCSS)) @@ -584,7 +558,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(chmod(config.permission)) @@ -632,7 +605,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - // .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(header(banner, settings.header)) @@ -648,7 +620,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { // unified css stream stream = gulp.src(source.definitions + '**/' + componentGlob + '.less') .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(flatten()) .pipe(replace(comments.variables.in, comments.variables.out)) @@ -666,7 +637,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(rename(settings.rename.rtlCSS)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) @@ -683,7 +653,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) .pipe(rename(settings.rename.rtlMinCSS)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.compressed)) @@ -769,10 +738,19 @@ gulp.task('package compressed js', false, function() { ; }); +/******************************* + Install Tasks +*******************************/ -/*-------------- - Config ----------------*/ +var + // install dependencies + jeditor = require('gulp-json-editor'), + prompt = require('gulp-prompt'), + wrench = require('wrench'), + + questions = require('./tasks/questions'), + +; gulp.task('check install', false, function () { setTimeout(function() { @@ -853,7 +831,6 @@ gulp.task('install', 'Set-up project for first time', function () { ; } - // determine semantic.json config if(answers.components) { json.components = answers.components; @@ -931,16 +908,36 @@ gulp.task('install', 'Set-up project for first time', function () { *******************************/ var + // admin dependencies + concatFileNames = require('gulp-concat-filenames'), + git = require('gulp-git'), + githubAPI = require('github'), + runSequence = require('run-sequence'), + tap = require('gulp-tap'), + + // admin files adminQuestions = require('./tasks/admin/questions'), - newVersion = false + release = require('./tasks/admin/release'), + + // stores oauth info for GitHub API + oAuth = fs.existsSync('./tasks/admin/oauth.js') + ? require('./tasks/admin/oauth') + : false, + github, + ; + +/*-------------- + Docs +---------------*/ + + /* Moves watched files to static site generator output */ gulp.task('serve-docs', false, function () { config = require('./tasks/admin/docs.json'); getConfigValues(); - // copy source files gulp .watch([ @@ -978,10 +975,18 @@ gulp.task('build-docs', false, function () { /* Release */ gulp.task('release', false, function() { - // gulp bump - // Ask for release type (minor, major, patch) - // Bump package.json - // Bump composer.json + + // gulp build + runSequence( + 'build', + 'create files' + ); + +}); + +/* Release All */ +gulp.task('release all', false, function() { + if(!oAuth) { console.error('Must add node include tasks/admin/oauth.js with oauth token for GitHub'); return; @@ -1000,17 +1005,12 @@ gulp.task('release', false, function() { }); // gulp build - //runSequence('update git'); - runSequence('build', 'create repos', 'update git'); - - // #Create SCSS Version - // #Create RTL Release - -}); + runSequence( + 'build', + 'create components', + 'update component repos' + ); -/* Build Component Release Only */ -gulp.task('build release', false, function() { - runSequence('build', 'create repos'); }); @@ -1018,8 +1018,18 @@ gulp.task('build release', false, function() { Internal ---------------*/ - -gulp.task('create repos', false, function(callback) { +/* + This will create individual component repositories for each SUI component + + * copy component files from release + * create commonjs files as index.js for NPM release + * create release notes that filter only items related to component + * custom package.json file from template + * create bower.json from template + * create README from template + * create meteor.js file +*/ +gulp.task('create components', false, function(callback) { var stream, index, @@ -1029,7 +1039,7 @@ gulp.task('create repos', false, function(callback) { for(index in release.components) { var - component = release.components[index] + component = release.components[index] ; // streams... designed to save time and make coding fun... @@ -1046,9 +1056,11 @@ gulp.task('create repos', false, function(callback) { repoURL = 'https://github.com/' + release.org + '/' + repoName + '/', regExp = { match : { - // readme - name : '{component}', - titleName : '{Component}', + // templated values + name : '{component}', + titleName : '{Component}', + version : '{version}', + files : '{files}', // release notes spacedVersions : /(###.*\n)\n+(?=###)/gm, spacedLists : /(^- .*\n)\n+(?=^-)/gm, @@ -1060,7 +1072,7 @@ gulp.task('create repos', false, function(callback) { formExport : /\$\.fn\.\w+\s*=\s*function\(fields, parameters\)\s*{/g, settingsExport : /\$\.fn\.\w+\.settings\s*=/g, settingsReference : /\$\.fn\.\w+\.settings/g, - jQuery : /jQuery/g + jQuery : /jQuery/g, }, replace : { // readme @@ -1085,11 +1097,11 @@ gulp.task('create repos', false, function(callback) { repo : component + ' create repo', bower : component + ' create bower.json', readme : component + ' create README', - readme : component + ' create README', npm : component + ' create NPM Module', notes : component + ' create release notes', composer : component + ' create composer.json', - package : component + ' create package.json' + package : component + ' create package.json', + meteor : component + ' create package.js', } ; @@ -1237,6 +1249,41 @@ gulp.task('create repos', false, function(callback) { ; }); + // Creates component meteor package.js + gulp.task(task.meteor, function() { + var + fileNames = '' + ; + if(isJavascript) { + fileNames += ' \'' + component + '.js\',\n'; + } + if(isCSS) { + fileNames += ' \'' + component + '.css\',\n'; + } + return gulp.src(outputDirectory + '/assets/**/' + component + '?(s).*', { base: outputDirectory}) + .pipe(concatFileNames('dummy.txt', { + newline : '', + root : outputDirectory, + prepend : ' \'', + append : '\',' + })) + .pipe(tap(function(file) { fileNames += file.contents;})) + .on('end', function(){ + gulp.src(release.templates.meteorComponent) + .pipe(plumber()) + .pipe(flatten()) + .pipe(replace(regExp.match.name, regExp.replace.name)) + .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) + .pipe(replace(regExp.match.version, version)) + .pipe(replace(regExp.match.files, fileNames)) + .pipe(rename(defaults.files.npm)) + .pipe(gulp.dest(outputDirectory)) + ; + }) + ; + }); + + // synchronous tasks in orchestrator? I think not gulp.task(task.all, false, function(callback) { runSequence([ @@ -1246,7 +1293,8 @@ gulp.task('create repos', false, function(callback) { task.readme, task.package, task.composer, - task.notes + task.notes, + task.meteor ], callback); }); @@ -1256,8 +1304,8 @@ gulp.task('create repos', false, function(callback) { } runSequence(tasks, callback); - }); + gulp.task('register repos', false, function(callback) { var index = -1, @@ -1298,11 +1346,11 @@ gulp.task('register repos', false, function(callback) { stepRepo(); }); */ - } + }; stepRepo(); }); -gulp.task('update git', false, function() { +gulp.task('update component repos', false, function() { var index = -1, total = release.components.length, @@ -1328,7 +1376,7 @@ gulp.task('update git', false, function() { repoURL = 'https://github.com/' + release.org + '/' + repoName + '/', gitOptions = { cwd: outputDirectory }, quietOptions = { args: '-q', cwd: outputDirectory }, - isRepository = fs.existsSync(outputDirectory + '.git/') + isRepository = fs.existsSync(outputDirectory + '.git/'), componentPackage = fs.existsSync(outputDirectory + 'package.json' ) ? require(outputDirectory + 'package.json') : false, @@ -1378,7 +1426,7 @@ gulp.task('update git', false, function() { mergeCommit(); } }); - }; + } function mergeCommit() { // commit files console.log('Adding merge commit', commitArgs); @@ -1413,7 +1461,7 @@ gulp.task('update git', false, function() { console.log('Push completed successfully'); stepRepo(); }); - }; + } // set-up path function createRepo() { @@ -1457,8 +1505,7 @@ gulp.task('update git', false, function() { stepRepo(); } }); - }; - + } }; return stepRepo(); diff --git a/meteor/README.md b/meteor/README.md new file mode 100644 index 000000000..c4f742e73 --- /dev/null +++ b/meteor/README.md @@ -0,0 +1,38 @@ +[Semantic-UI](http://semantic-ui.com/) packaged for [Meteor.js](http://meteor.com). + +# Usage + +```sh +meteor add semantic:ui +``` + +# Theming + +In case you wish to build your own theme you should follow the +[Recommended Usage (Themed)](https://github.com/Semantic-Org/Semantic-UI#recommended-usage-themed) +guide. + +After having build the project you'll get a ready to use meteor package +shipping your newly created theme. +Simply move the whole folder (or otherwise simlink it...) under your Meteor +app's `packages` folder run + +```sh +meteor add semantic:ui +``` + +from your app's main folder and that's it! + + +# Issues + +If you encounter a Meteor-related issue while using this package, +please CC @Semantic-Org/meteor when you +[file it](https://github.com/Semantic-Org/Semantic-UI/issues). + + +# Meteor + +If you're new to Meteor, here's what the excitement is all about - [watch the first two minutes](https://www.youtube.com/watch?v=fsi0aJ9yr2o); you'll be hooked by 1:28. + +That screencast is from 2012. In the meantime, Meteor has become a mature JavaScript-everywhere web development framework with numerous [advantages](http://www.meteorpedia.com/read/Why_Meteor) over all other single-page application frameworks. diff --git a/package.js b/package.js new file mode 100644 index 000000000..8dfcf3d2f --- /dev/null +++ b/package.js @@ -0,0 +1,38 @@ +var + where = 'client' // Adds files only to the client +; + +Package.describe({ + git : 'git://github.com/Semantic-Org/Semantic-UI.git', + name : 'semantic:ui', + readme : 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md', + summary : 'Semantic (official): a UI component framework based around useful principles from natural language.', + version : '1.7.0' +}); + +Package.onUse(function(api) { + api.versionsFrom('1.0'); + api.addFiles([ + 'dist/semantic.css', + 'dist/semantic.js', + 'dist/themes/default/assets/fonts/icons.eot', + 'dist/themes/default/assets/fonts/icons.otf', + 'dist/themes/default/assets/fonts/icons.svg', + 'dist/themes/default/assets/fonts/icons.ttf', + 'dist/themes/default/assets/fonts/icons.woff', + 'dist/themes/default/assets/images/flags.png' + ], where); +}); + +Package.onTest(function(api) { + api.use([ + 'http', + 'semantic:ui', + 'tinytest' + ], where); + + api.addFiles([ + 'test/meteor/assets.js', + 'test/meteor/fonts.js', + ], where); +}); diff --git a/package.json b/package.json index 7670a8b5a..dc35e09f6 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,9 @@ "gulp-clone": "^1.0.0", "gulp-concat": "^2.4.2", "gulp-concat-css": "^1.1.1", + "gulp-concat-filenames": "^0.0.3", "gulp-copy": "0.0.2", "gulp-csscomb": "^3.0.3", - "gulp-debug": "^1.0.1", "gulp-flatten": "0.0.4", "gulp-git": "^0.5.5", "gulp-header": "^1.2.2", @@ -49,7 +49,7 @@ "gulp-rename": "^1.2.0", "gulp-replace": "^0.5.0", "gulp-rtlcss": "^0.1.2", - "gulp-sourcemaps": "^1.2.8", + "gulp-tap": "^0.1.3", "gulp-uglify": "^1.0.1", "gulp-util": "^3.0.1", "gulp-watch": "^2.0.0", diff --git a/tasks/admin/release.js b/tasks/admin/release.js index 35446c5be..4d685e09e 100644 --- a/tasks/admin/release.js +++ b/tasks/admin/release.js @@ -15,11 +15,13 @@ module.exports = { }, templates: { - bower : './tasks/admin/templates/bower.json', - composer : './tasks/admin/templates/composer.json', - package : './tasks/admin/templates/package.json', - readme : './tasks/admin/templates/README.md', - notes : './RELEASE-NOTES.md' + bower : './tasks/admin/templates/bower.json', + composer : './tasks/admin/templates/composer.json', + package : './tasks/admin/templates/package.json', + meteor : './tasks/admin/templates/package.js', + meteorComponent : './tasks/admin/templates/package-component.js', + readme : './tasks/admin/templates/README.md', + notes : './RELEASE-NOTES.md' }, org : 'Semantic-Org', @@ -82,4 +84,3 @@ module.exports = { 'video' ] }; - diff --git a/tasks/admin/templates/README.md b/tasks/admin/templates/README.md index 38bcaf439..c3ee5b308 100644 --- a/tasks/admin/templates/README.md +++ b/tasks/admin/templates/README.md @@ -16,6 +16,12 @@ bower install semantic-ui-{component} 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) diff --git a/tasks/admin/templates/package-component.js b/tasks/admin/templates/package-component.js new file mode 100644 index 000000000..0f4c199ab --- /dev/null +++ b/tasks/admin/templates/package-component.js @@ -0,0 +1,17 @@ +var + where = 'client' // Adds files only to the client +; + +Package.describe({ + name : 'semantic:ui-{component}', + summary : 'Semantic UI - {Component} (official): Single component release of {component}', + version : '{version}', + git : 'git://github.com/Semantic-Org/UI-{Component}.git', +}); + +Package.onUse(function(api) { + api.versionsFrom('1.0'); + api.addFiles([ + {files} + ], where); +}); diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js new file mode 100644 index 000000000..1a59aff47 --- /dev/null +++ b/tasks/admin/templates/package.js @@ -0,0 +1,31 @@ +var + where = 'client' // Adds files only to the client +; + +Package.describe({ + name : 'semantic:ui', + summary : 'Semantic UI (Official): a UI component framework based around useful principles from natural language.', + version : '{version}', + git : 'git://github.com/Semantic-Org/Semantic-UI.git', + readme : 'https://github.com/Semantic-Org/README.md' +}); + +Package.onUse(function(api) { + api.versionsFrom('1.0'); + api.addFiles([ + {files} + ], where); +}); + +Package.onTest(function(api) { + api.use([ + 'tinytest', + 'http', + 'semantic:ui' + ], where); + + api.addFiles([ + 'test/meteor/fonts.js', + 'test/meteor/assets.js', + ], where); +}); diff --git a/tasks/defaults.js b/tasks/defaults.js index 000b835ef..300ce4be1 100644 --- a/tasks/defaults.js +++ b/tasks/defaults.js @@ -109,6 +109,7 @@ module.exports = { composer : 'composer.json', config : './semantic.json', npm : './package.json', + meteor : './package.js', site : './src/site', theme : './src/theme.config' }, @@ -129,4 +130,4 @@ module.exports = { }, clean : 'dist/' } -}; \ No newline at end of file +}; diff --git a/test/meteor/assets.js b/test/meteor/assets.js new file mode 100644 index 000000000..40f4b40ec --- /dev/null +++ b/test/meteor/assets.js @@ -0,0 +1,20 @@ +var assets = [ + 'dist/themes/default/assets/images/flags.png', +]; + +// Check that the font files are downloadable. Meteor places assets at /packages//. +assets.forEach(function (path) { + Tinytest.addAsync('image ' + path + ' is shipped', function (test, done) { + HTTP.get('/packages/semantic_ui/' + path, function callback(error, result) { + if (error) { + test.fail({message: 'Image failed to load'}); + } + else { + test.isTrue(result.content.length > 10000, 'Image ' + path + ' could not be downloaded'); + } + done(); + }); + }); +}); + + diff --git a/test/meteor/fonts.js b/test/meteor/fonts.js new file mode 100644 index 000000000..195d5159b --- /dev/null +++ b/test/meteor/fonts.js @@ -0,0 +1,16 @@ +// Check that the font files are downloadable. Meteor places assets at /packages//. +['eot', 'otf', 'svg', 'ttf', 'woff'] + .forEach(function (extension) { + Tinytest.addAsync(extension + ' fonts are shipped', function (test, done) { + HTTP.get('/packages/semantic_ui/dist/themes/default/assets/fonts/icons.' + extension, function callback(error, result) { + if (error) { + test.fail({message: 'Font failed to load'}); + } + else { + test.isTrue(result.content.length > 10000, extension + ' font could not be downloaded'); + } + done(); + }); + }); + }) +; \ No newline at end of file