Commit 86e4444700579959a413993ca467d645085832c8
1 parent
58f9cdd8
Exists in
master
and in
3 other branches
Criação de rotina de compilação no provisionamento e watcher dos diretórios #274
Showing
3 changed files
with
74 additions
and
5 deletions
Show diff stats
.gitignore
Vagrantfile
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | VAGRANTFILE_API_VERSION = "2" |
6 | 6 | |
7 | 7 | $firstTimeScript = <<SCRIPT |
8 | - | |
8 | +npm install gulp gulp-less gulp-minify-css gulp-sourcemaps gulp-util gulp-plumber --save-dev | |
9 | 9 | cd /vagrant && composer update && rm -r /var/www/public && ln -s /vagrant/src /var/www/public |
10 | 10 | |
11 | 11 | cp /vagrant/config/wp-config-vagrant.php /vagrant/src/wp-config.php |
... | ... | @@ -34,6 +34,9 @@ chmod 777 /vagrant/src/wp-content/ |
34 | 34 | |
35 | 35 | service apache2 start |
36 | 36 | |
37 | +cd /vagrant/src | |
38 | +gulp | |
39 | + | |
37 | 40 | SCRIPT |
38 | 41 | |
39 | 42 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
... | ... | @@ -55,12 +58,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
55 | 58 | # system('echo " |
56 | 59 | # rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 8080 |
57 | 60 | # rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 443 -> 127.0.0.1 port 8443 |
58 | -# " | sudo pfctl -f - > /dev/null 2>&1; echo "==> Fowarding Ports: 80 -> 8080, 443 -> 8443"') | |
61 | +# " | sudo pfctl -ef - > /dev/null 2>&1; echo "==> Fowarding Ports: 80 -> 8080, 443 -> 8443"') | |
59 | 62 | # end |
60 | - | |
63 | +# | |
61 | 64 | # config.trigger.after [:halt, :destroy] do |
62 | -# system("sudo pfctl -f /etc/pf.conf > /dev/null 2>&1; echo '==> Removing Port Forwarding'") | |
63 | - # end | |
65 | +# system("sudo pfctl -df /etc/pf.conf > /dev/null 2>&1; echo '==> Removing Port Forwarding'") | |
66 | +# end | |
64 | 67 | |
65 | 68 | ###### REDIRECIONAMENTO DA PORTA 80 PARA LINUX |
66 | 69 | # iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8080 | ... | ... |
... | ... | @@ -0,0 +1,65 @@ |
1 | +var gulp = require('gulp'); | |
2 | +var less = require('gulp-less'); | |
3 | +var minifyCss = require('gulp-minify-css'); | |
4 | +var sourcemaps = require('gulp-sourcemaps'); | |
5 | +var gutil = require('gulp-util'); | |
6 | +var plumber = require('gulp-plumber'); | |
7 | +var path = require('path'); | |
8 | + | |
9 | +var temas = ['blog','dadospessoais','debatepublico','marcocivil','pensandoodireito']; | |
10 | + | |
11 | +var plumberHandler = function (err) { | |
12 | + console.log(err); | |
13 | + this.emit('end'); | |
14 | + }; | |
15 | + | |
16 | +temas.forEach(function(item){ | |
17 | + gulp.task(item, function(){ | |
18 | + return gulp.src('src/wp-content/themes/'+item+'-tema/css/less/*.less') | |
19 | + .pipe(plumber({ | |
20 | + errorHandler: plumberHandler | |
21 | + })) | |
22 | + .pipe(less()) | |
23 | + .pipe(sourcemaps.init()) | |
24 | + .pipe(minifyCss()) | |
25 | + .pipe(sourcemaps.write()) | |
26 | + .pipe(gulp.dest('src/wp-content/themes/'+item+'-tema/css')); | |
27 | + }); | |
28 | +}); | |
29 | + | |
30 | +gulp.task('default', temas, function(){ | |
31 | + gulp.src('src/wp-content/themes/participacao-tema/css/less/site-global.less') | |
32 | + .pipe(plumber({ | |
33 | + errorHandler: plumberHandler | |
34 | + })) | |
35 | + .pipe(less({ | |
36 | + paths: [ 'src/wp-content/themes/participacao-tema/css/less' ] | |
37 | + })) | |
38 | + .pipe(sourcemaps.init()) | |
39 | + .pipe(minifyCss()) | |
40 | + .pipe(sourcemaps.write()) | |
41 | + .pipe(gulp.dest('src/wp-content/themes/participacao-tema/css')); | |
42 | + | |
43 | + gulp.src('src/wp-content/themes/participacao-tema/css/less/theme/theme-participacao.less') | |
44 | + .pipe(plumber({ | |
45 | + errorHandler: plumberHandler | |
46 | + })) | |
47 | + .pipe(less({ | |
48 | + paths: [ | |
49 | + 'src/wp-content/themes/participacao-tema/css/less', | |
50 | + ] | |
51 | + })) | |
52 | + .pipe(sourcemaps.init()) | |
53 | + .pipe(minifyCss()) | |
54 | + .pipe(sourcemaps.write()) | |
55 | + .pipe(gulp.dest('src/wp-content/themes/participacao-tema/css')); | |
56 | +}); | |
57 | + | |
58 | + | |
59 | +gulp.task('watch', function() { | |
60 | + temas.forEach(function(item){ | |
61 | + gulp.watch('src/wp-content/themes/'+item+'-tema/css/less/*.less', [item]); | |
62 | + }); | |
63 | +}); | |
64 | + | |
65 | + | ... | ... |