This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b68b80
commit b186a82
Showing
10 changed files
with
111 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,6 +267,23 @@ module.exports = function (grunt) { | |
dist: ['<%= yeoman.dist %>/*.html'] | ||
}, | ||
|
||
rsync: { | ||
options: { | ||
args: ['--verbose'], | ||
exclude: ['.git*','*.scss','node_modules'], | ||
recursive: true | ||
}, | ||
prod: { | ||
options: { | ||
src: '<%= yeoman.dist %>/', | ||
dest: '/home/linguagil/linguagil.com.br/', | ||
host: '[email protected]', | ||
syncDestIgnoreExcl: true | ||
} | ||
} | ||
}, | ||
|
||
|
||
// Allow the use of non-minsafe AngularJS files. Automatically makes it | ||
// minsafe compatible so Uglify does not destroy the ng references | ||
ngAnnotate: { | ||
|
@@ -374,7 +391,7 @@ module.exports = function (grunt) { | |
|
||
grunt.registerTask('modifyImageLinkInScript', 'Task for replace image link in script file.', function(filename, imageTarget) { | ||
var fs = require('fs'), | ||
SCRIPTS_DIST_DIR = 'dist/js', | ||
SCRIPTS_DIST_DIR = 'dist/scripts', | ||
IMAGE_DIST_DIR = 'dist/images', | ||
oldestImage = imageTarget | ||
; | ||
|
@@ -398,6 +415,32 @@ module.exports = function (grunt) { | |
|
||
}); | ||
|
||
grunt.registerTask('modifyImageLinkInStyles', 'Task for replace image link in stylesheet file.', function(filename, imageTarget) { | ||
var fs = require('fs'), | ||
STYLES_DIST_DIR = 'dist/styles', | ||
IMAGE_DIST_DIR = 'dist/images', | ||
oldestImage = imageTarget | ||
; | ||
|
||
fs.readdirSync(STYLES_DIST_DIR).forEach(function(file) { | ||
if ( file.indexOf(filename) !== (-1) ) { | ||
filename = STYLES_DIST_DIR+'/'+file; | ||
} | ||
}); | ||
|
||
fs.readdirSync(IMAGE_DIST_DIR).forEach(function(file) { | ||
if ( file.indexOf(oldestImage) !== (-1) ) { | ||
imageTarget = file; | ||
} | ||
}); | ||
|
||
var data = fs.readFileSync(filename, 'utf8'); | ||
data = data.replace(new RegExp(oldestImage, 'g'), imageTarget); | ||
|
||
fs.writeFileSync(filename, data, 'utf8'); | ||
|
||
}); | ||
|
||
grunt.registerTask('serve', function (target) { | ||
if (target === 'dist') { | ||
return grunt.task.run(['build', 'connect:dist:keepalive']); | ||
|
@@ -442,12 +485,26 @@ module.exports = function (grunt) { | |
'rev', | ||
'usemin', | ||
'htmlmin', | ||
'modifyImageLinkInScript:scripts.js:pin.png' | ||
'modifyImageLinkInScript:scripts.js:pin.png', | ||
'modifyImageLinkInStyles:main.css:home-background.jpg' | ||
]); | ||
|
||
grunt.registerTask('default', [ | ||
'newer:jshint', | ||
'test', | ||
'build' | ||
]); | ||
|
||
grunt.registerTask('travis', [ | ||
'bower-install', | ||
'jshint', | ||
'build', | ||
'htmllint:dist' | ||
]); | ||
|
||
grunt.registerTask('deploy', [ | ||
'travis', | ||
'rsync:prod' | ||
]); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.