diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bfa8b8a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +dist/ + +package-lock\.json diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..dd429f7 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,64 @@ +{ + /* + * ENVIRONMENTS + * ================= + */ + + // Define globals exposed by modern browsers. + "browser": true, + + // Define globals exposed by jQuery. + "jquery": true, + + // Define globals exposed by Node.js. + "node": true, + + // Allow ES6. + "esversion": 6, + + /* + * ENFORCING OPTIONS + * ================= + */ + + // Force all variable names to use either camelCase style or UPPER_CASE + // with underscores. + "camelcase": true, + + // Prohibit use of == and != in favor of === and !==. + "eqeqeq": true, + + // Enforce tab width of 2 spaces. + "indent": 4, + + // Prohibit use of a variable before it is defined. + "latedef": true, + + // Enforce line length to 100 characters + "maxlen": 100, + + // Require capitalized names for constructor functions. + "newcap": true, + + // Enforce use of single quotation marks for strings. + "quotmark": "single", + + // Enforce placing 'use strict' at the top function scope + "strict": false, + + // Prohibit use of explicitly undeclared variables. + "undef": true, + + // Warn when variables are defined but never used. + "unused": true, + + // Para que funcione en angular + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], + /* + * RELAXING OPTIONS + * ================= + */ + + // Suppress warnings about == null comparisons. + "eqnull": true +} diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..ae9a8a0 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,90 @@ +const gulp = require('gulp'); +const sass = require('gulp-sass'); +const concat = require('gulp-concat'); +const rename = require('gulp-rename'); +const uglify = require('gulp-uglify-es').default; +const pump = require('pump'); +const jshint = require('gulp-jshint'); +const replace = require('gulp-replace'); +const connect = require('gulp-connect'); +const watch = require('gulp-watch'); + +var paths = { + srcHTML : 'src/views/*.html', + srcJS : 'src/**/*.js', + dist : 'dist/', + distHTML : 'dist/views/' +}; + +gulp.task('uglify', function() { + pump( + [ + gulp.src(paths.srcJS), + concat('wrapper-demo.js'), + replace('/src/', '/dist/'), + gulp.dest(paths.dist), + rename('wrapper-demo.min.js'), + uglify(), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('html', function() { + pump([ + gulp.src('index.html'), + replace(/\.*\/sgm, ''), + gulp.dest(paths.dist) + ]); + pump([ + gulp.src(paths.srcHTML), + gulp.dest(paths.distHTML) + ]); +}) + +gulp.task('sass', function() { + return gulp.src('src/style/scss/**/*.scss') + .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) + .pipe(gulp.dest('css')); +}); + +gulp.task('pre-commit', function() { + pump( + [ + gulp.src(paths.srcJS), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); + gulp.start('uglify'); + gulp.start('sass'); +}); + +gulp.task('webserver', function() { + pump [ + connect.server( + { + port: 3000, + livereload: true + } + ) + ] +}); + +gulp.task('watch', function() { + gulp.watch(archivosJS, ['uglify']); + gulp.watch('css/scss/*.scss', ['sass']); +}) + +gulp.task('reload'), function() { + connect.reload(); +} + +gulp.task('livereload', function() { + gulp.watch('css/*.css', ['reload']); + gulp.watch('js/dist/*.js', ['reload']); + gulp.watch('vistas/**/*.html', ['reload']); +}); + +gulp.task('default', ['webserver']); diff --git a/index.html b/index.html new file mode 100644 index 0000000..269401e --- /dev/null +++ b/index.html @@ -0,0 +1,27 @@ + +
+ + +