-
Notifications
You must be signed in to change notification settings - Fork 2
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
jgrim
committed
Mar 20, 2018
1 parent
3dde557
commit a4191a2
Showing
6 changed files
with
94 additions
and
2 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/node_modules | ||
dist | ||
tmp |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var gulp = require('gulp'); | ||
var inlineNg2Template = require('gulp-inline-ng2-template'); | ||
|
||
gulp.task('default', function () { | ||
var result = gulp.src('../tmp/ngx-json-view/**/*.ts') | ||
.pipe(inlineNg2Template({ useRelativePaths: true })); | ||
|
||
return result | ||
.pipe(gulp.dest('../tmp/ngx-json-view')); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
var Promise = require('bluebird'); | ||
var fs = Promise.promisifyAll(require('fs')); | ||
var path = require('path'); | ||
var glob = require('glob'); | ||
var async = require('async'); | ||
|
||
var rootTmpDir = path.resolve(__dirname, '../tmp'); | ||
|
||
/** | ||
* Replace SCSS styleUrls references | ||
*/ | ||
glob(path.join(rootTmpDir, '**/*.ts'), function(err, matches) { | ||
console.log(matches); | ||
if (err) { | ||
console.log(error); | ||
return; | ||
} | ||
|
||
async.each(matches, function(filename, callback) { | ||
|
||
fs.readFileAsync(path.join(filename)) | ||
.then(function(file) { | ||
return file.toString().replace(/(?:styleUrls[\s]*:[\s]*)[\s]*\[.*(?:\.scss)+.*\]/g, function(match) { | ||
console.log('Replaced scss reference in file %s (%s)', filename, match); | ||
return match.replace('.scss', '.css'); | ||
}) | ||
}) | ||
.then(function(content) { | ||
return [filename, content]; | ||
}) | ||
.spread(fs.writeFileAsync) | ||
.then(function() { | ||
callback(); | ||
}); | ||
|
||
}, function(err) { | ||
// if any of the file processing produced an error, err would equal that error | ||
if( err ) { | ||
// One of the iterations produced an error. | ||
// All processing will now stop. | ||
console.log('A file failed to process'); | ||
console.log(err); | ||
} else { | ||
console.log('All files have been processed successfully'); | ||
} | ||
}); | ||
|
||
}); | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
], | ||
"files": [ | ||
"tmp/index.ts" | ||
], | ||
"angularCompilerOptions": { | ||
"annotateForClosureCompiler": true | ||
} | ||
} |