Permalink
Browse files

webpack + removed aggregation

still in dev
  • Loading branch information...
1 parent 34bc831 commit fce9521bb9e6470a32eb7b552a8a494a5dcf5d84 pavel committed Apr 7, 2016
View
0 Procfile 100755 → 100644
No changes.
View
@@ -0,0 +1,50 @@
+'use strict';
+
+import 'angular/angular-csp.css';
+import 'angular-ui-select/select.min.css';
+import 'bootstrap/dist/css/bootstrap.min.css';
+
+import jQuery from 'jquery';
+import 'angular';
+import 'angular-ui-select/select';
+import 'angular-mocks';
+import 'angular-cookies';
+import 'angular-resource';
+import 'angular-sanitize';
+import 'angular-ui-router';
+import 'angular-jwt';
+import 'angular-bootstrap/ui-bootstrap-tpls';
+
+window.$ = jQuery;
+
+angular.element(document).ready(function () {
+ //Fixing facebook bug with redirect
+ if (window.location.hash === '#_=_') window.location.hash = '#!';
+
+ //Then init the app
+ angular.bootstrap(document, ['mean']);
+
+});
+
+function processModules(modules) {
+ var packageModules = ['ngCookies', 'ngResource', 'ui.bootstrap', 'ui.router', 'ui.select', 'ngSanitize'], m, mn;
+ for (var index in modules) {
+ m = modules[index];
+ mn = 'mean.' + m.name;
+ angular.module(mn, m.angularDependencies || []);
+ packageModules.push(mn);
+ }
+
+ var req = require.context("./packages", true, /\/public\/(?!tests|assets|views)(.*)\.js$/);
+ req.keys().map(req);
+ var req = require.context("./node_modules", true, /\/meanio-(admin|system|users|circles)\/public\/(?!tests|assets|views)(.*)\.js$/);
+ req.keys().map(req);
+
+ angular.module('mean', packageModules);
+}
+
+jQuery.ajax('/_getModules', {
+ dataType: 'json',
+ async: false,
+ success: processModules
+});
View
@@ -1,17 +1,6 @@
{
"name": "mean",
"dependencies": {
- "jquery": "latest",
- "angular": "latest",
- "angular-resource": "latest",
- "angular-cookies": "latest",
- "angular-mocks": "latest",
- "angular-route": "latest",
- "bootstrap": "latest",
- "angular-bootstrap": "latest",
- "angular-ui-router": "#master",
- "web-bootstrap": "./node_modules/meanio/resources/web-bootstrap.js",
- "angular-ui-select": "latest",
- "angular-sanitize": "latest"
+
}
}
View
2 config/express.js 100755 → 100644
@@ -39,6 +39,8 @@ module.exports = function(app, db) {
// Enable compression on bower_components
app.use('/bower_components', express.static(config.root + '/bower_components'));
+ app.use('/bundle', express.static(config.root + '/bundle'));
+
// Adds logging based on logging config in config/env/ entry
require('./middlewares/logging')(app, config.logging);
View
@@ -1,112 +1,128 @@
'use strict';
var gulp = require('gulp'),
- gulpLoadPlugins = require('gulp-load-plugins'),
- through = require('through'),
- gutil = require('gulp-util'),
- plugins = gulpLoadPlugins(),
- coffee = require('gulp-coffee'),
- paths = {
- js: ['./*.js', 'config/**/*.js', 'gulp/**/*.js', 'tools/**/*.js', 'packages/**/*.js', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**', '!packages/**/assets/**/js/**'],
- html: ['packages/**/*.html', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
- css: ['packages/**/*.css', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**','!packages/core/**/public/assets/css/*.css'],
- less: ['packages/**/*.less', '!packages/**/_*.less', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
- sass: ['packages/**/*.scss', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
- coffee: ['packages/**/*.coffee', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**']
- };
+ gulpLoadPlugins = require('gulp-load-plugins'),
+ through = require('through'),
+ gutil = require('gulp-util'),
+ plugins = gulpLoadPlugins(),
+ paths = {
+ js: ['./*.js', 'config/**/*.js', 'gulp/**/*.js', 'tools/**/*.js', 'packages/**/*.js', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**', '!packages/**/assets/**/js/**'],
+ html: ['packages/**/*.html', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
+ css: ['packages/**/*.css', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**', '!packages/core/**/public/assets/css/*.css'],
+ less: ['packages/**/*.less', '!packages/**/_*.less', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
+ sass: ['packages/**/*.scss', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
+ webpack: ['./app.js', 'packages/**/public/**/*.css', 'packages/**/public/**/*.js', '!packages/**/public/assets/lib/**', '!packages/**/node_modules/**']
+ };
+var webpack = require("webpack");
+var webpackConfig = require("../webpack.config.js");
/*var defaultTasks = ['clean', 'jshint', 'less', 'csslint', 'devServe', 'watch'];*/
-var defaultTasks = ['coffee','clean', 'less', 'sass', 'csslint', 'devServe', 'watch'];
+var defaultTasks = ['webpack:build-dev','clean', 'less', 'sass', 'csslint', 'devServe', 'watch'];
gulp.task('env:development', function () {
- process.env.NODE_ENV = 'development';
+ process.env.NODE_ENV = 'development';
});
gulp.task('jshint', function () {
- return gulp.src(paths.js)
- .pipe(plugins.jshint())
- .pipe(plugins.jshint.reporter('jshint-stylish'))
- // .pipe(plugins.jshint.reporter('fail')) to avoid shutdown gulp by warnings
- .pipe(count('jshint', 'files lint free'));
+ return gulp.src(paths.js)
+ .pipe(plugins.jshint())
+ .pipe(plugins.jshint.reporter('jshint-stylish'))
+ // .pipe(plugins.jshint.reporter('fail')) to avoid shutdown gulp by warnings
+ .pipe(count('jshint', 'files lint free'));
});
gulp.task('csslint', function () {
- return gulp.src(paths.css)
- .pipe(plugins.csslint('.csslintrc'))
- .pipe(plugins.csslint.reporter())
- .pipe(count('csslint', 'files lint free'));
+ return gulp.src(paths.css)
+ .pipe(plugins.csslint('.csslintrc'))
+ .pipe(plugins.csslint.reporter())
+ .pipe(count('csslint', 'files lint free'));
});
-gulp.task('less', function() {
- return gulp.src(paths.less)
- .pipe(plugins.less())
- .pipe(gulp.dest('./packages'));
+gulp.task('less', function () {
+ return gulp.src(paths.less)
+ .pipe(plugins.less())
+ .pipe(gulp.dest('./packages'));
});
-gulp.task('sass', function() {
- return gulp.src(paths.sass)
- .pipe(plugins.sass().on('error', plugins.sass.logError))
- .pipe(gulp.dest('./packages'));
+gulp.task('sass', function () {
+ return gulp.src(paths.sass)
+ .pipe(plugins.sass().on('error', plugins.sass.logError))
+ .pipe(gulp.dest('./packages'));
});
gulp.task('devServe', ['env:development'], function () {
- plugins.nodemon({
- script: 'server.js',
- ext: 'html js',
- env: { 'NODE_ENV': 'development' } ,
- ignore: [
- 'node_modules/',
- 'bower_components/',
- 'logs/',
- 'packages/*/*/public/assets/lib/',
- 'packages/*/*/node_modules/',
- '.DS_Store', '**/.DS_Store',
- '.bower-*',
- '**/.bower-*',
- '**/tests'
- ],
- nodeArgs: ['--debug'],
- stdout: false
- }).on('readable', function() {
- this.stdout.on('data', function(chunk) {
- if(/Mean app started/.test(chunk)) {
- setTimeout(function() { plugins.livereload.reload(); }, 500);
- }
- process.stdout.write(chunk);
+ plugins.nodemon({
+ script: 'server.js',
+ ext: 'html js',
+ env: {'NODE_ENV': 'development'},
+ ignore: [
+ 'node_modules/',
+ 'bower_components/',
+ 'logs/',
+ 'packages/*/*/public/assets/lib/',
+ 'packages/*/*/node_modules/',
+ '.DS_Store', '**/.DS_Store',
+ '.bower-*',
+ '**/.bower-*',
+ '**/tests'
+ ],
+ nodeArgs: ['--debug'],
+ stdout: false
+ }).on('readable', function () {
+ this.stdout.on('data', function (chunk) {
+ if (/Mean app started/.test(chunk)) {
+ setTimeout(function () {
+ plugins.livereload.reload();
+ }, 500);
+ }
+ process.stdout.write(chunk);
+ });
+ this.stderr.pipe(process.stderr);
});
- this.stderr.pipe(process.stderr);
- });
});
-gulp.task('coffee', function() {
- gulp.src(paths.coffee)
- .pipe(coffee({bare: true}).on('error', gutil.log))
- .pipe(gulp.dest('./packages'));
+
+// modify some webpack config options
+var myDevConfig = Object.create(webpackConfig);
+myDevConfig.devtool = "sourcemap";
+myDevConfig.debug = true;
+// create a single instance of the compiler to allow caching
+var devCompiler = webpack(myDevConfig);
+gulp.task('webpack:build-dev', function(callback) {
+ // run webpack
+ devCompiler.run(function(err, stats) {
+ if(err) throw new gutil.PluginError("webpack:build-dev", err);
+ gutil.log("[webpack:build-dev]", stats.toString({
+ colors: true
+ }));
+ callback();
+ });
});
gulp.task('watch', function () {
- plugins.livereload.listen({interval:500});
+ plugins.livereload.listen({interval: 500});
- gulp.watch(paths.coffee,['coffee']);
- gulp.watch(paths.js, ['jshint']);
- gulp.watch(paths.css, ['csslint']).on('change', plugins.livereload.changed);
- gulp.watch(paths.less, ['less']);
- gulp.watch(paths.sass, ['sass']);
+ gulp.watch(paths.js, ['jshint']);
+ gulp.watch(paths.css, ['csslint']).on('change', plugins.livereload.changed);
+ gulp.watch(paths.less, ['less']);
+ gulp.watch(paths.sass, ['sass']);
+ gulp.watch(paths.webpack, ['webpack:build-dev']);
});
function count(taskName, message) {
- var fileCount = 0;
+ var fileCount = 0;
+
+ function countFiles(file) {
+ fileCount++; // jshint ignore:line
+ }
- function countFiles(file) {
- fileCount++; // jshint ignore:line
- }
+ function endStream() {
+ gutil.log(gutil.colors.cyan(taskName + ': ') + fileCount + ' ' + message || 'files processed.');
+ this.emit('end'); // jshint ignore:line
+ }
- function endStream() {
- gutil.log(gutil.colors.cyan(taskName + ': ') + fileCount + ' ' + message || 'files processed.');
- this.emit('end'); // jshint ignore:line
- }
- return through(countFiles, endStream);
+ return through(countFiles, endStream);
}
gulp.task('development', defaultTasks);
View
@@ -20,7 +20,17 @@
"postinstall": "node tools/scripts/postinstall.js"
},
"dependencies": {
- "meanio": "git://github.com/linnovate/meanio.git#0.9.0",
+ "meanio": "git://github.com/pashist/meanio.git#0.9.0",
+ "angular-bootstrap": "^0.12.2",
+ "angular-cookies": "^1.5.2",
+ "angular-jwt": "latest",
+ "angular-mocks": "^1.5.2",
+ "angular-resource": "^1.5.2",
+ "angular-route": "^1.5.2",
+ "angular-sanitize": "^1.5.2",
+ "angular-ui-router": "^0.2.18",
+ "angular-ui-select": "^0.12.100",
+ "bootstrap": "latest",
"body-parser": "latest",
"compression": "latest",
"connect-flash": "latest",
@@ -36,10 +46,14 @@
"view-helpers": "latest"
},
"devDependencies": {
+ "babel-core": "^6.7.2",
+ "babel-loader": "^6.2.4",
+ "babel-preset-es2015": "^6.6.0",
+ "babel-preset-stage-1": "^6.5.0",
+ "css-loader": "^0.23.1",
"del": "latest",
"expect.js": "latest",
"gulp": "latest",
- "gulp-coffee": "latest",
"gulp-concat": "latest",
"gulp-csslint": "latest",
"gulp-cssmin": "latest",
@@ -54,6 +68,8 @@
"gulp-util": "latest",
"jasmine": "latest",
"jasmine-reporters": "latest",
+ "jquery": "latest",
+ "jsonwebtoken": "latest",
"jshint": "latest",
"jshint-stylish": "latest",
"karma": "latest",
@@ -71,10 +87,12 @@
"karma-script-launcher": "latest",
"mocha": "latest",
"protractor": "latest",
- "phantomjs": "latest",
+ "phantomjs-prebuilt": "latest",
"require-dir": "latest",
"requirejs": "latest",
"supertest": "latest",
- "through": "latest"
+ "through": "latest",
+ "webpack": "^1.12.14",
+ "webpack-dev-server": "^1.14.1"
}
}
@@ -16,9 +16,6 @@ MeanStarter.register(function(app, users, system) {
// Set views path, template engine and default layout
app.set('views', __dirname + '/server/views');
- MeanStarter.aggregateAsset('css', 'common.css');
- MeanStarter.aggregateAsset('css', 'loginForms.css');
- MeanStarter.aggregateAsset('css', 'starter.css');
MeanStarter.angularDependencies(['mean.system', 'mean.users']);
return MeanStarter;
@@ -6,15 +6,11 @@
"name": "MEAN.io"
},
"mean": "0.6.0",
- "engines": {
- "node": "4.2.x",
- "npm": "2.14.x"
- },
"dependencies": {
- "meanio-system": "latest",
- "meanio-users": "latest",
- "meanio-circles": "latest",
- "meanio-admin": "latest"
+ "meanio-system": "git://github.com/pashist/meanio-system.git",
+ "meanio-users": "git://github.com/pashist/meanio-users.git",
+ "meanio-circles": "git://github.com/pashist/meanio-circles.git",
+ "meanio-admin": "git://github.com/pashist/meanio-admin.git"
},
"license": "MIT"
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,5 @@
+'use strict';
+
+import './assets/css/common.css';
+import './assets/css/loginForms.css';
+import './assets/css/starter.css';
@@ -1,6 +1,4 @@
-{% for file in aggregatedassets.footer.js %}
- <script type="text/javascript" src="{{file}}"></script>
-{% endfor %}
+<script type="text/javascript" src="/bundle/app.js"></script>
{% if (process.env.NODE_ENV == 'development') %}
<script type="text/javascript" src="{{'//' + req.hostname + ':35729/livereload.js'}}"></script>
Oops, something went wrong.

0 comments on commit fce9521

Please sign in to comment.