Commit f415a3ca authored by Hadrien RENAUD's avatar Hadrien RENAUD

Merge branch 'master' into 'develop'

# Conflicts:
#   test/configure-vm.sh
parents 4f8b6d59 dc62a349
Pipeline #4651 passed with stage
in 11 minutes and 43 seconds
node_modules
node_modules_old
dist
dist.new
dist.bak
dist.bak.bak
.tmp
.sass-cache
bower_components
......
image : circleci/node:latest
#test:
# script:
# - sudo apt install python-pip python-dev
# - git clone https://gitlab.binets.fr/br/chocapix-server.git ../chocapix-server
# - ./test/configure-vm.sh
# - npm install grunt
# - ./node_modules/.bin/grunt serve &
# - sleep 5
# - ./test-in-vm.sh run
build:
script:
- make
artifacts:
paths:
- dist
expire_in: 1 week
......@@ -14,6 +14,9 @@ module.exports = function (grunt) {
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Load serve-static
var serveStatic = require('serve-static');
// Configurable paths for the application
var appConfig = {
......@@ -82,12 +85,12 @@ module.exports = function (grunt) {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
serveStatic('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
serveStatic('./bower_components')
),
connect.static(appConfig.app)
serveStatic(appConfig.app)
];
}
}
......@@ -97,13 +100,13 @@ module.exports = function (grunt) {
port: 9001,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
serveStatic('.tmp'),
serveStatic('test'),
connect().use(
'/bower_components',
connect.static('./bower_components')
serveStatic('./bower_components')
),
connect.static(appConfig.app)
serveStatic(appConfig.app)
];
}
}
......
.PHONY: clean install
install: notroot
export HOME=`mktemp -d /tmp/npmXXXXXX ` ;\
npm install &&\
npm install gulp bower &&\
node_modules/.bin/bower install &&\
rm -rf dist.bak &&\
if [ -d dist ] ; then mv dist dist.bak ; fi ;\
sudo node_modules/.bin/gulp build ;\
clean:
rm -rf .npm
rm -rf node_modules
rm -rf .tmp
rm -rf bower_components
notroot:
getent group `id --group` | grep -v root --quiet
app/assets/img/sections/equitationjone.png

8.33 KB | W: | H:

app/assets/img/sections/equitationjone.png

8.68 KB | W: | H:

app/assets/img/sections/equitationjone.png
app/assets/img/sections/equitationjone.png
app/assets/img/sections/equitationjone.png
app/assets/img/sections/equitationjone.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -3,7 +3,7 @@
angular.module('bars.granking')
.factory('ranking.items', function () {
return {
beer: [2, 3, 1, 5, 6, 558, 4, 7, 1334, 1024, 1584, 697, 696, 1249, 1247, 1248, 1250, 1251, 340, 3754, 1602, 3236, 747, 1405, 1787, 1788, 3810, 418, 1392, 2596, 3472, 1330, 2495, 2598, 340, 1517, 558, 2597, 1586, 2494, 3230, 2493, 1300, 1284, 966, 809, 2596, 2194, 2778, 1582, 963],
pizza: [131, 134, 135, 136, 140, 300, 361, 377, 378, 416, 526, 528, 529, 639, 640, 641, 642, 726, 772, 774, 775, 776, 790, 792, 849, 989, 991, 1139, 1142, 1158, 1159, 1160, 1338, 1431, 1433, 1556, 1705, 1731, 1732, 1733, 1734, 1735, 1769, 1959, 2069, 2071, 2074, 2079, 2341, 2342, 2442, 2595, 2703, 2704, 2857, 2876, 2877, 2879, 2880, 2881, 2882, 2911, 2912, 2941, 3031, 3137, 3292, 3308, 3309, 3310, 3473, 3534, 3535, 3573, 3613, 3721, 3746, 3816, 3863, 3864, 3879, 3904, 3908, 3923, 3924, 3942, 3943]
beer: [2, 3, 1, 5, 6, 558, 4, 7, 1334, 1024, 1584, 697, 696, 1249, 1247, 1248, 1250, 1251, 340, 3754, 1602, 3236, 747, 1405, 1787, 1788, 3810, 418, 1392, 2596, 3472, 1330, 2495, 2598, 340, 1517, 558, 2597, 1586, 2494, 3230, 2493, 1300, 1284, 966, 809, 2596, 2194, 2778, 1582, 963, 1327, 10588, 5746, 11156],
pizza: [131, 134, 135, 136, 140, 300, 361, 377, 378, 416, 526, 528, 529, 639, 640, 641, 642, 726, 772, 774, 775, 776, 790, 792, 849, 989, 991, 1139, 1142, 1158, 1159, 1160, 1338, 1431, 1433, 1556, 1705, 1731, 1732, 1733, 1734, 1735, 1769, 1959, 2069, 2071, 2074, 2079, 2341, 2342, 2442, 2595, 2703, 2704, 2857, 2876, 2877, 2879, 2880, 2881, 2882, 2911, 2912, 2941, 3031, 3137, 3292, 3308, 3309, 3310, 3473, 3534, 3535, 3573, 3613, 3721, 3746, 3816, 3863, 3864, 3879, 3904, 3908, 3923, 3924, 3942, 3943, 7609, 7608]
};
});
......@@ -162,7 +162,6 @@ angular.module('bars.api.food', [
})
.state('bar.food.details', {
url: "/:id",
controller: 'api.ctrl.food_details',
resolve: {
food_item: ['$stateParams', 'api.models.sellitem', function($stateParams, SellItem) {
return SellItem.getSync($stateParams.id);
......@@ -185,7 +184,7 @@ angular.module('bars.api.food', [
controller: 'api.ctrl.food_details.stocks',
},
'graphs@bar.food.details': {
templateUrl: "components/API/food/views/details-graphs.html",
templateUrl: "components/API/food/views/details-graphs.html",
controller: 'api.ctrl.food_details.graphs',
},
'ranking@bar.food.details': {
......
......@@ -12,6 +12,17 @@ angular.module('bars.admin', [
.config(['$stateProvider', function($stateProvider) {
$stateProvider.state('bar.admin', {
url: "/admin",
resolve: {
account_list: ['api.models.account', function(Account) {
return Account.all();
}],
stockitem_list: ['api.models.stockitem', function(StockItem) {
return StockItem.all();
}],
bar_account: ['api.models.account', function(Account) {
return Account.ofUser(6);
}]
},
views: {
'@bar': {
templateUrl: "components/admin/layout.html",
......@@ -19,18 +30,7 @@ angular.module('bars.admin', [
},
'@bar.admin': {
templateUrl: "components/admin/dashboard.html",
controller: 'admin.ctrl.home',
resolve: {
account_list: ['api.models.account', function(Account) {
return Account.all();
}],
stockitem_list: ['api.models.stockitem', function(StockItem) {
return StockItem.all();
}],
bar_account: ['api.models.account', function(Account) {
return Account.ofUser(6);
}]
}
controller: 'admin.ctrl.home'
}
}
});
......
<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
<div class="col-sm-12 col-md-12 col-lg-12">
<h3>Auto-Appro : Ooshop</h3>
<div class="row" ng-show="stape == 1">
<div class="col-md-2 text-right h3">
Étape 1<br />
<small>Connexion</small>
</div>
<div class="col-md-10">
<form class="form-horizontal" ng-submit="stape1.validate(stape1.login, stape1.password)">
<div class="form-group">
<label class="col-md-4 col-lg-2 control-label">Adresse email</label>
<div class="col-md-8 col-lg-10">
<input type="email" class="form-control" placeholder="louis.vaneau@polytechnique.edu" ng-model="stape1.login" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 col-lg-2 control-label">Mot de passe</label>
<div class="col-md-8 col-lg-10">
<input type="password" class="form-control" placeholder="****" ng-model="stape1.password" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-4 col-md-8 col-lg-10 col-lg-offset-2">
<button type="submit" class="btn btn-success" ng-class="stape1.loading && 'disabled' || ''">
Connexion à Ooshop <span class="glyphicon-refresh-animate glyphicon glyphicon-refresh" ng-show="stape1.loading"></span>
</button>
</div>
</div>
</form>
</div>
</div>
<div class="row" ng-show="stape == 2">
<div class="col-md-2 text-right h3">
Étape 2<br />
<small>Choix de la commande</small>
</div>
<div class="col-md-10">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>Date</th>
<th>Numéro de commande</th>
<th class="text-center">Prévisualiser</th>
<th class="text-center">Sélectionner</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in stape2.orders">
<td>{{ order.date | amParse:'DD/MM/YYYY' | amCalendar }}</td>
<td>{{ order.id }}</td>
<td class="text-center">
<a href ng-click="stape2.preview(order)" ng-show="!order.loadingp">Prévisualiser</a>
<span class="glyphicon-refresh-animate glyphicon glyphicon-refresh" ng-if="order.loadingp"></span>
</td>
<td class="text-center">
<a href ng-click="stape2.select(order)" ng-show="!order.loadings">Sélectionner</a>
<span class="glyphicon-refresh-animate glyphicon glyphicon-refresh" ng-if="order.loadings"></span>
</td>
</tr>
</tbody>
</table>
<div class="col-md-10">
<div class="well">
Séléctionne la facture de l’appro au format PDF (à télécharger sur la page <a href="https://ooshop.carrefour.fr/orders">Mes dernières commandes</a>).
</div>
<form class="form-horizontal" ng-submit="validate()">
<div class="form-group">
<input required id="receipt_pdf" type="file" />
<button type="submit" class="btn btn-success" ng-class="parsing_receipt && 'disabled' || ''">Valider</button>
</div>
</form>
<p ng-show="parsing_receipt">Analyse du PDF en cours...</p>
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-12">
<h3>Auto-Appro : Ooshop</h3>
<div class="col-md-10">
<div class="well">
Rendez-vous sur www.ooshop.com, dans l’onglet <a href="http://www.ooshop.com/courses-en-ligne/WebForms/Utilisateur/MesCommandes.aspx">Mes commandes</a>, puis séléctionnez "Imprimer la facture" pour la commande voulue. Refusez l’impression, mais copiez la facture intégralement (avec ctrl-A ctrl-C par exemple), puis collez-la dans l’encadré suivant (ctrl-V).
</div>
<form class="form-horizontal" ng-submit="validate(input)">
<div class="form-group">
<label class="col-md-4 col-lg-2 control-label">Copiez votre facture Ooshop ici</label>
<div class="col-md-8 col-lg-10">
<textarea name="Facture" class="form-control" ng-model="input" />
</div>
<button type="submit" class="btn btn-success" ng-class="input == '' && 'disabled' || ''">Valider</button>
</div>
</form>
</div>
</div>
......@@ -229,80 +229,98 @@ angular.module('bars.admin.food', [
.controller('admin.ctrl.food.autoappro.ooshop',
['$scope', '$http', '$modal', '$state', 'admin.appro',
function($scope, $http, $modal, $state, Appro) {
// var OOSHOP_URL = 'http://mshop.carrefour.com/convertigo/projects/ooshop/.json'; // Original URL but no Access-Control-Origin header
// var OOSHOP_URL = 'https://neo.ntag.fr/ooshop/'; // Reverse proxy by ntag
var OOSHOP_URL = AUTOAPPRO_URL + '/ooshop/.json'; // Reverse proxy in the school
var cli_id;
function connexion(login, password) {
$scope.stape1.loading = true;
$http.get(OOSHOP_URL + '?__sequence=Login&login=' + login + '&password=' + password).then(function(result) {
if (result.data.document.isLogged == "false") {
throw("Wrong Ooshop password");
/**
* Extract text from a pdf file.
* Returns an array of arrays of strings.
* Found on:
* https://stackoverflow.com/questions/1554280/extract-text-from-pdf-in-javascript#29111164
*/
function pdfToText(data) {
pdfjsLib.workerSrc = '../../../../bower_components/pdfjs-dist/build/pdf.worker.min.js';
pdfjsLib.cMapUrl = 'js/vendor/pdfjs/cmaps/';
pdfjsLib.cMapPacked = true;
return pdfjsLib.getDocument(data).then(function(pdf) {
var pages = [];
for (var i = 0; i < pdf.numPages; i++) {
pages.push(i);
}
cli_id = result.data.document.cli_id;
return $http.get(OOSHOP_URL + '?__sequence=GetMyAccount&cli_id=' + cli_id);
}).then(function(result2) {
$scope.stape = 2;
$scope.stape1.loading = false;
$scope.stape2.orders = result2.data.document.commandes.commande;
}).catch(function() {
$scope.stape1.password = '';
$scope.stape1.loading = false;
return Promise.all(pages.map(function(pageNumber) {
return pdf.getPage(pageNumber + 1).then(function(page) {
return page.getTextContent().then(function(textContent) {
return textContent.items.map(function(item) {
return item.str;
});
});
});
})).then(function(pages) {
return pages;
});
});
}
function getOrder(id) {
return $http.get(OOSHOP_URL + '?__sequence=GetCmdProduct&cli_id=' + cli_id + '&id=' + id);
}
function previewOrder(order) {
order.loadingp = true;
getOrder(order.id).then(function(result) {
order.loadingp = false;
var modalOrder = $modal.open({
templateUrl: 'components/admin/food/autoappro/ooshop-modal-order.html',
controller: ['$scope', 'items', function ($scope, items) {
$scope.items = items;
}],
size: 'lg',
resolve: {
items: function () {
return result.data.document.items.TABLE;
function parseReceipt(receiptPdf) {
// receiptPdf must be a path to a pdf file or a Buffer.
return pdfToText(receiptPdf).then(function(result) {
function addItemToAutoAppro(qty, price, barcode, name) {
if (qty != 0 && !Appro.addItemFromBarcode(barcode, qty, price))
Appro.failedAutoAppro.push({name: name, qty: qty, totalPrice: price, barcode: barcode});
}
for (var j = 0, m = result.length ; j < m ; ++j) {
var page = result[j];
var step = 0;
var ean13 = '', libelle = '', qte_livree = 0, montant_ttc = 0;
for (var i = 0, n = page.length ; i < n ; ++i) {
var line = page[i];
if (step == 0 && line.search(/^[0-9]{13}$/) != -1) { ean13 = line; ++step; }
else if (step == 1) { name = line; ++step; }
else if (step == 3) { qte_livree = parseInt(line); ++step; }
else if (step == 7) { montant_ttc = parseFloat(line); ++step; }
else if (step == 8) {
if (line[0] == ' ') {
name += line;
} else {
addItemToAutoAppro(qte_livree, montant_ttc, ean13, name);
step = 0;
--i; // Relire la ligne car c'est surement le code barre de l'aliment suivant
ean13 = '';
}
}
else if (step != 0) ++step;
}
});
if (ean13 != '')
addItemToAutoAppro(qte_livree, montant_ttc, ean13, name);
}
});
}
function selectOrder(order) {
order.loadings = true;
getOrder(order.id).then(function(result) {
_.forEach(result.data.document.items.TABLE, function(item) {
var barcode = item.img_product_url.replace("Media/ProdImages/Produit/Images/", "").replace(".gif", "");
if (!Appro.addItemFromBarcode(barcode, parseFloat(item.art_qte), parseFloat(item.uvc_buy)*parseFloat(item.art_qte))) {
Appro.failedAutoAppro.push({
name: item.title,
qty: parseFloat(item.art_qte),
totalPrice: parseFloat(item.uvc_buy)*parseFloat(item.art_qte),
barcode: barcode,
container: item.contenance,
link: "http://www.ooshop.com/courses-en-ligne/ContentNavigation.aspx?NOEUD_IDFO=" + item.id
});
}
function getReceipt() {
$scope.parsing_receipt = true;
var receipt = document.getElementById("receipt_pdf").files[0];
var reader = new FileReader();
reader.readAsArrayBuffer(receipt);
reader.onload = function (evt) {
parseReceipt(evt.target.result).then(function() {
$state.go('bar.admin.food.appro', {bar: $scope.bar.id});
}, function (err) {
$scope.parsing_receipt = false;
allowValidate = true;
});
order.loadings = false;
$state.go('bar.admin.food.appro', {bar: $scope.bar.id});
});
}
}
$scope.input = '';
$scope.parsing_receipt = false;
var allowValidate = true;
$scope.validate = function () {
if (allowValidate) {
allowValidate = false;
getReceipt();
}
}
$scope.stape = 1;
$scope.stape1 = {
login: '',
password: '',
validate: connexion,
loading: false
};
$scope.stape2 = {
orders: [],
preview: previewOrder,
select: selectOrder
};
}
])
.controller('admin.ctrl.food.autoappro.intermarche',
......
This diff is collapsed.
var API_URL = "http://127.0.0.1:8000";
var OFF_URL = "http://fr.openfoodfacts.org/api/v0/produit";
//var API_URL = "https://api.chocapix.binets.fr";
//var OFF_URL = "https://off.chocapix.binets.fr";
//var API_URL = "http://127.0.0.1:8000";
//var OFF_URL = "http://fr.openfoodfacts.org/api/v0/produit";
var API_URL = "https://api.chocapix.binets.fr";
var OFF_URL = "https://off.chocapix.binets.fr";
var AUTOAPPRO_URL = "https://autoappro.chocapix.binets.fr";
......@@ -13,11 +13,11 @@
<link rel="stylesheet" href="../bower_components/html5-boilerplate/dist/css/normalize.css">
<link rel="stylesheet" href="../bower_components/html5-boilerplate/dist/css/main.css">
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/animate.css/animate.css" />
<link rel="stylesheet" href="bower_components/morris.js/morris.css" />
<link rel="stylesheet" href="bower_components/angular-ui-bootstrap-datetimepicker/datetimepicker.css" />
<link rel="stylesheet" href="bower_components/angular-loading-bar/build/loading-bar.css" />
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="../bower_components/animate.css/animate.css" />
<link rel="stylesheet" href="../bower_components/morris.js/morris.css" />
<link rel="stylesheet" href="../bower_components/angular-ui-bootstrap-datetimepicker/datetimepicker.css" />
<link rel="stylesheet" href="../bower_components/angular-loading-bar/build/loading-bar.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css({.tmp,app}) styles/main.css -->
......@@ -25,7 +25,7 @@
<!-- endbuild -->
<!-- build:js scripts/modernizr.js -->
<script src="../bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js"></script>
<script src="../bower_components/html5-boilerplate/dist/js/vendor/modernizr-3.6.0.min.js"></script>
<!-- endbuild -->
</head>
<body ng-app="barsApp">
......@@ -73,36 +73,38 @@
<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/es5-shim/es5-shim.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/json3/lib/json3.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-messages/angular-messages.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/angular-loader/angular-loader.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/angular-moment/angular-moment.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="bower_components/lodash/lodash.js"></script>
<script src="bower_components/moment-range/dist/moment-range.js"></script>
<script src="bower_components/ngstorage/ngStorage.js"></script>
<script src="bower_components/raphael/raphael.js"></script>
<script src="bower_components/mocha/mocha.js"></script>
<script src="bower_components/morris.js/morris.js"></script>
<script src="bower_components/ngInfiniteScroll/build/ng-infinite-scroll.js"></script>
<script src="bower_components/angular-ui-bootstrap-datetimepicker/datetimepicker.js"></script>
<script src="bower_components/angular-loading-bar/build/loading-bar.js"></script>
<script src="bower_components/js-sha1/build/sha1.min.js"></script>
<script src="../bower_components/angular/angular.js"></script>
<script src="../bower_components/json3/lib/json3.js"></script>
<script src="../bower_components/es5-shim/es5-shim.js"></script>
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="../bower_components/angular-animate/angular-animate.js"></script>
<script src="../bower_components/angular-cookies/angular-cookies.js"></script>
<script src="../bower_components/angular-messages/angular-messages.js"></script>
<script src="../bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="../bower_components/angular-touch/angular-touch.js"></script>
<script src="../bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="../bower_components/angular-loader/angular-loader.js"></script>
<script src="../bower_components/moment/moment.js"></script>
<script src="../bower_components/angular-moment/angular-moment.js"></script>
<script src="../bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="../bower_components/lodash/lodash.js"></script>
<script src="../bower_components/ngstorage/ngStorage.js"></script>
<script src="../bower_components/eve-raphael/eve.js"></script>
<script src="../bower_components/raphael/raphael.min.js"></script>
<script src="../bower_components/mocha/mocha.js"></script>
<script src="../bower_components/morris.js/morris.js"></script>
<script src="../bower_components/ngInfiniteScroll/build/ng-infinite-scroll.js"></script>
<script src="../bower_components/angular-ui-bootstrap-datetimepicker/datetimepicker.js"></script>
<script src="../bower_components/angular-loading-bar/build/loading-bar.js"></script>
<script src="../bower_components/js-sha1/build/sha1.min.js"></script>
<script src="../bower_components/pdfjs-dist/build/pdf.js"></script>
<script src="../bower_components/pdfjs-dist/build/pdf.worker.js"></script>
<!-- endbower -->
<script src="../bower_components/moment/locale/fr.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<!-- build:js({app,.tmp}) scripts/scripts.js -->
<script src="assets/js/angular-locale_fr-fr.js"></script>
<script src="config.js"></script>
......
......@@ -29,7 +29,8 @@
"ngInfiniteScroll": "1.2.0",
"angular-ui-bootstrap-datetimepicker": "*",
"angular-loading-bar": "~0.8.0",
"js-sha1": "~0.3.0"
"js-sha1": "~0.3.0",
"pdfjs-dist": "^2.0.550"
},
"devDependencies": {
"angular-mocks": "~1.3.0",
......
'use strict';
'use strict';
var gulp = require('gulp');
var fs = require('fs');
var uglify = require('gulp-uglify-es').default;
var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
});
......@@ -27,40 +28,37 @@ gulp.task('partials', function () {
}))
.pipe(gulp.dest('.tmp'))
.pipe($.size());
});
});
gulp.task('html', ['wiredep', 'scripts', 'partials'], function () {
var htmlFilter = $.filter('*.html');
var jsFilter = $.filter('**/*.js');
var cssFilter = $.filter('**/*.css');
var htmlFilter = $.filter('*.html', {restore: true}); var jsFilter = $.filter('**/*.js', {restore: true});
var cssFilter = $.filter('**/*.css', {restore: true});
var assets;
fs.writeFile('dist/version.json', JSON.stringify({build_date: new Date()}));
fs.writeFileSync('dist/version.json', JSON.stringify({build_date: new Date()}));
return gulp.src('app/*.html')
.pipe($.inject(gulp.src('.tmp/**/*.js'), {
read: false,
//read: false,
starttag: '<!-- inject:partials -->',
addRootSlash: false,
addPrefix: '../'
}))
.pipe(assets = $.useref.assets())
.pipe($.useref({ searchPath: 'app' }))
.pipe($.rev())
.pipe(jsFilter)
.pipe($.stripDebug())
.pipe($.ngAnnotate())
.pipe($.uglify({preserveComments: $.uglifySaveLicense}))
.pipe(jsFilter.restore())
.pipe(uglify())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe($.csso())
.pipe(cssFilter.restore())
.pipe(assets.restore())
.pipe(cssFilter.restore)
.pipe($.useref())
.pipe($.revReplace())
.pipe(htmlFilter)
......@@ -69,7 +67,7 @@ gulp.task('html', ['wiredep', 'scripts', 'partials'], function () {
spare: true,
quotes: true
}))
.pipe(htmlFilter.restore())
.pipe(htmlFilter.restore)
.pipe(gulp.dest('dist'))
.pipe($.size());
......