Skip to content

Instantly share code, notes, and snippets.

@redexp
Created October 14, 2014 12:59
Show Gist options
  • Save redexp/74361d30481751eccb54 to your computer and use it in GitHub Desktop.
Save redexp/74361d30481751eccb54 to your computer and use it in GitHub Desktop.
Write styles for titanium alloy like normal node js module and this code will convert it to tss. Expects js files will be in `styles-scr` folder.
var gulp = require('gulp'),
watch = require('gulp-watch'),
plumb = require('gulp-plumber'),
replace = require('gulp-replace'),
rename = require('gulp-rename');
gulp.task('tss', function () {
watch('app/styles-src/*.js')
.pipe(plumb())
.pipe(replace(/.*?\{/m, ''))
.pipe(replace(/}\s*;/, ''))
.pipe(rename({extname: '.tss'}))
.pipe(gulp.dest('app/styles/'))
;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment