diff --git a/.bowerrc b/.bowerrc index d5ad908..de69020 100755 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,3 @@ { - "directory": "lib/bower_components" + "directory": "docs/bower_components/" } diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100755 index becbf30..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,398 +0,0 @@ -// Generated on 2014-03-04 using generator-angular 0.7.1 -'use strict'; - -// # Globbing -// for performance reasons we're only matching one level down: -// 'test/spec/{,*/}*.js' -// use this if you want to recursively match all subfolders: -// 'test/spec/**/*.js' - -module.exports = function (grunt) { - // Load grunt tasks automatically - require('load-grunt-tasks')(grunt); - - // Time how long tasks take. Can help when optimizing build times - require('time-grunt')(grunt); - - // Define the configuration for all the tasks - grunt.initConfig({ - - // Project settings - yeoman: { - // configurable paths - app: 'docs', - dist: 'dist', - lib: 'lib', - ver: grunt.file.readJSON("bower.json").version - }, - - // Watches files for changes and runs tasks based on the changed files - watch: { - js: { - files: ['<%= yeoman.app %>/scripts/{,*/}*.js', '<%= yeoman.lib %>/scripts/{,*/}*.js'], - tasks: ['newer:jshint:all'], - options: { - livereload: '<%= connect.options.livereload %>' - } - }, - jsTest: { - files: ['test/spec/{,*/}*.js'], - tasks: ['newer:jshint:test', 'karma'] - }, - styles: { - files: ['<%= yeoman.app %>/styles/{,*/}*.css'], - tasks: ['newer:copy:styles', 'autoprefixer'] - }, - stylus: { - files: ['<%= yeoman.app %>/styles/**/*.styl', '<%= yeoman.lib %>/**/*.styl'], - tasks: ['stylus', 'autoprefixer'] - }, - gruntfile: { - files: ['Gruntfile.js'] - }, - livereload: { - options: { - livereload: '<%= connect.options.livereload %>' - }, - files: [ - '<%= yeoman.app %>/**/*.html', - '.tmp/styles/{,*/}*.css', - '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' - ] - } - }, - - // The actual grunt server settings - connect: { - options: { - port: 9002, - // Change this to '0.0.0.0' to access the server from outside. - hostname: '0.0.0.0', - livereload: 35739, - middleware: function(connect, options) { - var middlewares = []; - var directory = options.directory || options.base[options.base.length - 1]; - middlewares.push(function(req, res, next) { - res.setHeader('Access-Control-Allow-Origin', '*'); - next(); - }); - middlewares.push(require('connect-modrewrite')(['!\\.html|\\.js|\\.svg|\\.css|\\.png|\\.eot|\\.ttf|\\.woff$ /index.html [L]'])); - - if (!Array.isArray(options.base)) { - options.base = [options.base]; - } - options.base.forEach(function(base) { - // Serve static files. - middlewares.push(connect.static(base)); - }); - // Make directory browse-able. - middlewares.push(connect.directory(directory)); - // Handle 404 - // middlewares.push(function(req, res) { - // res.end(grunt.file.read(options.base[1] + '/index.html')); - // }); - return middlewares; - } - }, - livereload: { - options: { - open: true, - base: [ - '.tmp', - '<%= yeoman.app %>', - '<%= yeoman.lib %>' - ] - } - }, - test: { - options: { - port: 9003, - base: [ - '.tmp', - 'test', - '<%= yeoman.app %>', - '<%= yeoman.lib %>' - ] - } - }, - dist: { - options: { - base: '<%= yeoman.dist %>' - } - } - }, - - // Make sure code styles are up to par and there are no obvious mistakes - jshint: { - options: { - laxcomma: true, - jshintrc: '.jshintrc', - reporter: require('jshint-stylish') - }, - all: [ - 'Gruntfile.js', - '<%= yeoman.app %>/scripts/{,*/}*.js', - '<%= yeoman.lib %>/scripts/{,*/}*.js' - ], - test: { - options: { - jshintrc: 'test/.jshintrc' - }, - src: ['test/spec/{,*/}*.js'] - } - }, - - // Empties folders to start fresh - clean: { - dist: { - files: [{ - dot: true, - src: [ - '.tmp', - '<%= yeoman.dist %>/*', - '!<%= yeoman.dist %>/.git*' - ] - }] - }, - server: '.tmp' - }, - - // Add vendor prefixed styles - autoprefixer: { - options: { - browsers: ['ie 8', 'ff 24', 'chrome 10', 'safari 3.1', 'opera 12', 'android 2.1', 'bb 7', 'ios 3.2'] - }, - dist: { - files: [{ - expand: true, - cwd: '.tmp/styles/', - src: '{,*/}*.css', - dest: '.tmp/styles/' - }] - } - }, - - // Automatically inject Bower components into the app - wiredep: { - app: { - cwd: '<%= yeoman.app %>', - src: '<%= yeoman.app %>/index.html', - ignorePath: '<%= yeoman.app %>/', - fileTypes: { - html: { - replace: { - js: '', - css: '' - } - } - } - }, - dist: { - src: '<%= yeoman.app %>/index.html', - ignorePath: '<%= yeoman.app %>/' - } - }, - - // Renames files for browser caching purposes - rev: { - dist: { - files: { - src: [ - '<%= yeoman.dist %>/scripts/{,*/}*.js', - '<%= yeoman.dist %>/styles/{,*/}*.css', - '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', - '<%= yeoman.dist %>/styles/fonts/*' - ] - } - } - }, - - // Performs rewrites based on rev and the useminPrepare configuration - usemin: { - css: ['.tmp/styles/**/*.css'], - options: { - assetsDirs: ['<%= yeoman.dist %>'] - } - }, - - // The following *-min tasks produce minified files in the dist folder - imagemin: { - dist: { - files: [{ - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.{png,jpg,jpeg,gif}', - dest: '<%= yeoman.dist %>/images' - }] - } - }, - svgmin: { - dist: { - files: [{ - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.svg', - dest: '<%= yeoman.dist %>/images' - }] - } - }, - htmlmin: { - dist: { - options: { - collapseWhitespace: true, - collapseBooleanAttributes: true, - removeCommentsFromCDATA: true, - removeOptionalTags: true - }, - files: [{ - expand: true, - cwd: '<%= yeoman.dist %>', - src: ['*.html', 'views/{,*/}*.html'], - dest: '<%= yeoman.dist %>' - }] - } - }, - - // Copies remaining files to places other tasks can use - copy: { - dist: { - files: [{ - expand: true, - dot: true, - cwd: '<%= yeoman.lib %>', - dest: '<%= yeoman.dist %>', - src: [ - 'fonts/fondant.*' - ] - }] - }, - styles: { - expand: true, - cwd: '<%= yeoman.app %>/styles', - dest: '.tmp/styles/', - src: '{,*/}*.css' - }, - fonts: { - expand: true, - cwd: '<%= yeoman.lib %>/fonts', - dest: '.tmp/fonts/', - src: '*' - } - }, - - // Run some tasks in parallel to speed up the build process - concurrent: { - server: [ - 'stylus', - 'copy:styles', - 'copy:fonts' - ], - test: [ - 'stylus', - 'copy:styles' - ], - dist: [ - 'stylus', - // 'copy:styles', - 'imagemin', - 'svgmin' - ] - }, - - // By default, your `index.html`'s will take care of - // minification. These next options are pre-configured if you do not wish - // to use the Usemin blocks. - cssmin: { - dist: { - options: { - banner: '/*! fondant <%= yeoman.ver %> | MIT License | github.com/zedgu/fondant */' - }, - files: { - '<%= yeoman.dist %>/styles/fondant.css': [ - '.tmp/styles/fondant.css' - ], - '<%= yeoman.dist %>/styles/fondant-ie8.css': [ - '.tmp/styles/fondant-ie8.css' - ] - } - } - }, - uglify: { - dist: { - options: { - banner: '/*! fondant <%= yeoman.ver %> | MIT License | github.com/zedgu/fondant */' - }, - files: { - '<%= yeoman.dist %>/scripts/fondant.js': [ - '<%= yeoman.lib %>/scripts/*.js' - ] - } - } - }, - // concat: { - // dist: {} - // }, - - // Test settings - karma: { - unit: { - configFile: 'karma.conf.js', - singleRun: true - } - }, - stylus: { - compile: { - files: { - '.tmp/styles/stylus.css': ['<%= yeoman.app %>/styles/index.styl'], - '.tmp/styles/fondant.css': ['<%= yeoman.lib %>/styles/index.styl'], - '.tmp/styles/fondant-ie8.css': ['<%= yeoman.lib %>/styles/ie8.styl'] - } - } - } - }); - - - grunt.registerTask('serve', function (target) { - if (target === 'dist') { - return grunt.task.run(['build', 'connect:dist:keepalive']); - } - - grunt.task.run([ - 'clean:server', - 'wiredep:app', - 'concurrent:server', - 'autoprefixer', - 'connect:livereload', - 'watch' - ]); - }); - - grunt.registerTask('server', function () { - grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); - grunt.task.run(['serve']); - }); - - grunt.registerTask('test', [ - 'clean:server', - 'concurrent:test', - 'autoprefixer', - 'connect:test', - 'karma' - ]); - - grunt.registerTask('build', [ - 'clean:dist', - 'concurrent:dist', - 'autoprefixer', - 'copy:dist', - 'cssmin', - 'uglify', - // 'rev', - ]); - - grunt.registerTask('default', [ - 'newer:jshint', - 'test', - 'build' - ]); -}; diff --git a/bower.json b/bower.json index 19faa38..99a0975 100755 --- a/bower.json +++ b/bower.json @@ -2,11 +2,21 @@ "name": "fondant", "version": "0.0.10", "dependencies": { - "angular": "^1.2.18", - "angular-file-upload": "^0.5.7", + "angular": "~1.2.18", + "angular-resource": "~1.2.18", + "angular-cookies": "~1.2.18", + "angular-sanitize": "~1.2.18", + "angular-route": "~1.2.18", + "angular-highlightjs": "~0.2.5", + "angular-scenario": "~1.2.18", + "angular-file-upload": "~0.5.7", "normalize-css": "~3.0.1" }, - "devDependencies": {}, + "devDependencies": { + "angular-mocks": "~1.2.18", + "json3": "~3.2.6", + "es5-shim": "~2.1.0" + }, "homepage": "https://github.com/zedgu/fondant", "authors": [ "zedgu " @@ -33,13 +43,10 @@ ], "license": "MIT", "ignore": [ - ".*", "**/.*", + "node_modules", "bower_components", - "docs", - "lib", "test", - "node_modules", "Gruntfile.js", "*.conf.js", "package.json" diff --git a/docs/.bowerrc b/docs/.bowerrc deleted file mode 100755 index 44491d3..0000000 --- a/docs/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "bower_components" -} diff --git a/docs/bower.json b/docs/bower.json deleted file mode 100755 index 2ae32db..0000000 --- a/docs/bower.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "fondant-docs", - "version": "0.0.3", - "dependencies": { - "angular": "~1.2.18", - "angular-resource": "~1.2.18", - "angular-cookies": "~1.2.18", - "angular-sanitize": "~1.2.18", - "angular-route": "~1.2.18", - "angular-highlightjs": "~0.2.5", - "angular-scenario": "~1.2.18", - "angular-file-upload": "~0.5.7", - "normalize-css": "~3.0.1" - }, - "devDependencies": { - "angular-mocks": "~1.2.18", - "json3": "~3.2.6", - "es5-shim": "~2.1.0" - }, - "homepage": "https://github.com/zedgu/fondant", - "authors": [ - "zedgu " - ], - "description": "A CSS3 UI Framework", - "main": [ - "dist/scripts/fondant.js", - "dist/styles/fondant.css", - "dist/fonts/fondant.svg", - "dist/fonts/fondant.eot", - "dist/fonts/fondant.ttf", - "dist/fonts/fondant.woff" - ], - "moduleType": [ - "node" - ], - "keywords": [ - "html5", - "css3", - "ui", - "framework", - "js", - "angular" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "Gruntfile.js", - "*.conf.js", - "package.json" - ] -} diff --git a/docs/index.html b/docs/index.html index e50233f..e861e1f 100755 --- a/docs/index.html +++ b/docs/index.html @@ -16,7 +16,7 @@ - + + diff --git a/gulpfile.js b/gulpfile.js new file mode 100755 index 0000000..01e8b50 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,270 @@ +const del = require('del'); +var gulp = require('gulp'); +var htmlmin = require('gulp-htmlmin'); +var cleanCSS = require('gulp-clean-css'); +var uglify = require('gulp-uglify'); +var stripDebug = require('gulp-strip-debug'); +var imageMin = require('gulp-imagemin'); +var browserSync = require('browser-sync') +var pngquant = require('imagemin-pngquant'); +var jsHint = require('gulp-jshint'); +var RevAll = require('gulp-rev-all'); +var replace = require('gulp-replace'); +var stylus = require('gulp-stylus'); +var bower = require('gulp-bower'); +var rename = require('gulp-rename'); +var wiredep = require('gulp-wiredep'); +var inject = require('gulp-inject'); +var autoprefixer = require('gulp-autoprefixer'); +var svgmin = require('gulp-svgmin'); +var usemin = require('gulp-usemin'); +// var useref = require('gulp-useref'); + +// Paths config +var paths = { + root: '', + dist: { + index: 'dist/', + styles: 'dist/styles/', + scripts: 'dist/scripts/', + fonts: 'dist/fonts/', + svg: 'dist/svg/' + }, + lib: { + styles: 'lib/styles/', + fonts: 'lib/fonts/', + scripts: 'lib/scripts/', + svg: 'lib/svg/' + }, + docs: { + index: 'docs/', + styles: 'docs/styles/', + scripts: 'docs/scripts/', + fonts: 'docs/fonts/', + bower: 'docs/bower_components/' + }, + cdn: { + index: 'cdn/' + } +}; + +// CDN prefix +var cdnPrefix = "cdn.sitename.com"; + +// fondant recommend that you use the following command +// `gulp build` or `gulp serve` +gulp.task('build', ['clean:dist', 'build:fonts', 'build:stylus', "build:scripts"]); + +gulp.task('serve', ['watch'], function() { + browserSyncTask(paths.docs.index); + // watch(); +}); + +gulp.task('test', ['jshint']); + +gulp.task('default', ['serve']); + +function browserSyncTask(path) { + browserSync({ + port: 3000, + open: true, + files: paths.docs.index + '**', + server: { + // directory: true, + baseDir: path, + middleware: [ + require('connect-modrewrite')(['!\\.html|\\.js|\\.svg|\\.css|\\.png|\\.eot|\\.ttf|\\.woff$ /index.html [L]']), + function(req, res, next) { + res.setHeader('Access-Control-Allow-Origin', '*'); + next(); + } + ] + } + }); +} + +function serveStylus () { + gulp.src(paths.lib.styles + 'index.styl') + .pipe(stylus({ + 'include css': true, + compress: false + })) + .pipe(autoprefixer({ + browsers: ['ie 8', 'ff 24', 'chrome 10', 'safari 3.1', 'opera 12', 'android 2.1', 'bb 7', 'ios 3.2'], + cascade: false + })) + .pipe(rename('fondant.css')) + .pipe(gulp.dest(paths.docs.styles)); + gulp.src(paths.lib.styles + 'ie8.styl') + .pipe(stylus({ + 'include css': true, + compress: false + })) + .pipe(rename('fondant-ie8.css')) + .pipe(gulp.dest(paths.docs.styles)); + gulp.src(paths.docs.styles + 'index.styl') + .pipe(stylus({ + 'include css': true, + compress: true + })) + .pipe(rename('stylus.css')) + .pipe(gulp.dest(paths.docs.styles)); +} + +function copyScripts () { + gulp.src(paths.lib.scripts + "*.js") + .pipe(stripDebug()) + .pipe(gulp.dest(paths.docs.scripts)); + gulp.src(paths.lib.scripts + "*.js") + .pipe(stripDebug()) + .pipe(gulp.dest(paths.docs.scripts)); +} + +function copyFonts () { + return gulp.src(paths.lib.fonts + 'fondant.*') + .pipe(gulp.dest(paths.docs.fonts)); +} + +gulp.task('jshint', function () { + return gulp.src(paths.lib.scripts + '*.js') + .pipe(jsHint()) + .pipe(jsHint.reporter('default')); +}); + +// `gulp build` subtask +gulp.task('clean:dist', function () { + del.sync([paths.dist.index + '**']); +}); + +gulp.task('build:fonts', function () { + return gulp.src(paths.lib.fonts + 'fondant.*') + .pipe(gulp.dest(paths.dist.fonts)); +}); + +gulp.task('build:stylus', function () { + return gulp.src(paths.lib.styles + 'index.styl') + .pipe(stylus({ + 'include css': true, + compress: false + })) + .pipe(autoprefixer({ + browsers: ['ie 8', 'ff 24', 'chrome 10', 'safari 3.1', 'opera 12', 'android 2.1', 'bb 7', 'ios 3.2'], + cascade: false + })) + .pipe(cleanCSS({ + compatibility: 'ie6' + })) + .pipe(rename('fondant.css')) + .pipe(gulp.dest(paths.dist.styles)); +}); + +gulp.task('build:scripts', function () { + return gulp.src(paths.lib.scripts + "*.js") + .pipe(stripDebug()) + .pipe(uglify()) + .pipe(gulp.dest(paths.dist.scripts)); +}); + +// `gulp serve` subtask +gulp.task('bower', function () { + return bower({directory: paths.docs.bower, interactive: true}); +}); + +gulp.task('wiredep', ['bower'], function () { + gulp.src(paths.docs.index + 'index.html') + .pipe(wiredep({ + fileTypes: { + html: { + replace: { + js: '', + css: '' + } + } + } + })) + .pipe(gulp.dest(paths.docs.index)); +}); + +gulp.task('serve:stylus', function () { + serveStylus(); +}); + +gulp.task('copy', ['copy:fonts', 'copy:scripts']); + +gulp.task('copy:fonts', function () { + copyFonts(); +}); + +gulp.task('copy:scripts', function () { + copyScripts(); +}); + +gulp.task('watch', ['wiredep', 'copy', 'serve:stylus'], function() { + gulp.watch([paths.lib.styles + '**/*.styl', paths.docs.styles + '*.styl']).on('change', function () { + serveStylus(); + }); +}); + +gulp.watch(paths.lib.scripts + '*.js').on('change', function () { + copyScripts(); +}); + +gulp.watch(paths.lib.fonts + '**').on('change', function () { + copyFonts(); +}); + +// other task +gulp.task('imagesmin', function() { + return gulp.src([paths.docs.images + '**']) + .pipe(imageMin({ + progressive: true, + use: [pngquant({ + quality: '65-80', + speed: 4 + })] + })) + .pipe(gulp.dest(paths.docs.images)); +}); + +gulp.task('clean:cdn', function () { + del.sync([paths.cdn.index + '**']); +}); + +gulp.task('revision', ['clean:cdn'], function() { + var revAll = new RevAll({ + transformPath: function(rev, source) { + if (/lib\//.test(rev)) { + return cdnPrefix + source.replace(/\.\//, ''); + } + return rev.replace(/^\.\//, cdnPrefix); + }, + dontRenameFile: [/lib\//g] + // , + // dontUpdateReference: [/lib\//g] + }); + return gulp.src(paths.dist.index + '**') + .pipe(revAll.revision()) + .pipe(gulp.dest(paths.cdn.index)); +}); + +gulp.task('replaceVersionRef', function() { + return gulp.src(paths.cdn.index + '*.html') + .pipe(replace(/index\.([\d\w]{8,12})\.html/, '$1')) + .pipe(gulp.dest(paths.cdn.index)); +}); + +gulp.task('svg', function () { + return gulp.src(paths.lib.svg + '*.svg') + .pipe(svgmin()) + .pipe(gulp.dest(paths.dist.svg)); +}); + +gulp.task('usemin', function () { + return gulp.src(paths.docs.index + 'index.html') + .pipe(usemin({ + html: [function () {return htmlmin({empty: true});}], + js: ['uglify', 'revision'], + inlinejs: ['uglify'] + })) + .pipe(gulp.dest(paths.docs.index)); +}); \ No newline at end of file diff --git a/package.json b/package.json old mode 100755 new mode 100644 index 957a2a0..b970ae6 --- a/package.json +++ b/package.json @@ -1,46 +1,31 @@ { "name": "fondant", - "version": "0.0.10", + "version": "0.0.11", "dependencies": {}, "devDependencies": { - "connect-modrewrite": "^0.6.4", - "grunt": "^0.4.5", - "grunt-autoprefixer": "^0.4.2", - "grunt-concurrent": "^0.4.3", - "grunt-contrib-clean": "^0.5.0", - "grunt-contrib-coffee": "^0.7.0", - "grunt-contrib-compass": "^0.6.0", - "grunt-contrib-concat": "^0.3.0", - "grunt-contrib-connect": "^0.5.0", - "grunt-contrib-copy": "^0.4.1", - "grunt-contrib-cssmin": "^0.7.0", - "grunt-contrib-htmlmin": "^0.1.3", - "grunt-contrib-imagemin": "^0.3.0", - "grunt-contrib-jshint": "^0.7.2", - "grunt-contrib-stylus": "^0.13.2", - "grunt-contrib-uglify": "^0.2.7", - "grunt-contrib-watch": "^0.5.3", - "grunt-karma": "^0.6.2", - "grunt-newer": "^0.5.4", - "grunt-rev": "^0.1.0", - "grunt-svgmin": "^0.2.1", - "grunt-usemin": "^2.4.0", - "grunt-wiredep": "^1.8.0", - "jshint-stylish": "^0.1.5", - "karma": "^0.10.10", - "karma-chrome-launcher": "^0.1.2", - "karma-coffee-preprocessor": "^0.1.3", - "karma-firefox-launcher": "^0.1.3", - "karma-html2js-preprocessor": "^0.1.0", - "karma-jasmine": "^0.1.5", - "karma-ng-html2js-preprocessor": "^0.1.0", - "karma-ng-scenario": "^0.1.0", - "karma-phantomjs-launcher": "^0.1.4", - "karma-requirejs": "^0.2.2", - "karma-script-launcher": "^0.1.0", - "load-grunt-tasks": "^0.2.1", - "requirejs": "^2.1.14", - "time-grunt": "^0.2.10" + "browser-sync": "^2.11.1", + "connect-modrewrite": "^0.9.0", + "del": "^2.2.0", + "gulp": "^3.9.0", + "gulp-autoprefixer": "^3.1.0", + "gulp-bower": "^0.0.13", + "gulp-clean-css": "^2.0.4", + "gulp-connect": "^4.0.0", + "gulp-htmlmin": "^1.3.0", + "gulp-imagemin": "^2.4.0", + "gulp-inject": "3.0.0", + "gulp-jshint": "^2.0.0", + "gulp-rename": "^1.2.2", + "gulp-replace": "^0.5.4", + "gulp-rev-all": "^0.8.24", + "gulp-strip-debug": "^1.1.0", + "gulp-stylus": "^2.3.1", + "gulp-svgmin": "^1.2.2", + "gulp-uglify": "^1.5.1", + "gulp-usemin": "^0.3.23", + "gulp-useref": "^3.0.8", + "gulp-wiredep": "^0.0.0", + "imagemin-pngquant": "^4.2.2" }, "engines": { "node": ">=0.8.0"