Browse Source

Fix gulp issues

pull/1191/head
jlukic 10 years ago
parent
commit
c13243425d
2 changed files with 67 additions and 62 deletions
  1. 35
      gulpfile.js
  2. 94
      tasks/questions.js

35
gulpfile.js

@ -100,6 +100,7 @@ if(config) {
: config.components[0]
: ''
;
console.log(compiledFilter);
// relative paths
assetPaths = {
@ -349,6 +350,7 @@ gulp.task('version', 'Displays current version of Semantic', function(callback)
---------------*/
gulp.task('package uncompressed css', false, function() {
console.log(output.uncompressed + '**/' + compiledFilter + '!(*.min|*.map).css');
return gulp.src(output.uncompressed + '**/' + compiledFilter + '!(*.min|*.map).css')
.pipe(replace(assetPaths.uncompressed, assetPaths.packaged))
.pipe(concatCSS('semantic.css'))
@ -396,7 +398,7 @@ gulp.task('package compressed js', false, function() {
gulp.task('check install', false, function () {
setTimeout(function() {
if( !config ) {
if( !config || !fs.existsSync('./src/theme.config')) {
console.log('No semantic.json file found. Starting install...');
gulp.start('install');
}
@ -407,21 +409,23 @@ gulp.task('check install', false, function () {
});
gulp.task('install', 'Set-up project for first time', function () {
console.clear();
gulp
.src(defaults.paths.source.config)
.src('gulpfile.js')
.pipe(prompt.prompt(questions.setup, function(answers) {
var
siteVariable = /@siteFolder .*\'(.*)\'/mg,
siteVariable = /@siteFolder .*\'(.*)/mg,
templates = {
theme : './src/theme.config.example',
json : './semantic.json.example',
site : './src/_site'
themeConfig : './src/theme.config.example',
jsonConfig : './semantic.json.example',
site : './src/_site'
},
siteDestination = answers.site || './src/site',
themeDestination = './src/theme.config',
themeDestination = './src/',
pathToSite = path.relative(path.resolve('./src'), path.resolve(siteDestination)),
sitePathReplace = "@siteFolder : '" + pathToSite + "/';",
configExists = fs.existsSync('./semantic.json'),
themeConfigExists = fs.existsSync('./src/theme.config'),
@ -457,22 +461,23 @@ gulp.task('install', 'Set-up project for first time', function () {
// copy recursively without overwrite
wrench.copyDirSyncRecursive(templates.site, siteDestination, settings.wrench.recursive);
// adjust less variable for site folder location
console.info('Adjusting @siteFolder', defaults.paths.source.config, themeDestination);
if(themeConfigExists) {
console.error('./src/theme.config already exists, skipping');
gulp.src('./src/theme.config')
.pipe(replace(siteVariable, sitePathReplace))
.pipe(gulp.dest(themeDestination))
;
}
else {
console.info('Creating src/theme.config (LESS config)');
gulp.src(templates.theme)
gulp.src(templates.themeConfig)
.pipe(rename({ extname : '' }))
.pipe(replace(siteVariable, sitePathReplace))
.pipe(gulp.dest(themeDestination))
;
}
// adjust less variable for site folder location
console.info('Adjusting @siteFolder', pathToSite);
gulp.src(themeDestination)
.pipe(replace(siteVariable, pathToSite))
.pipe(gulp.dest(themeDestination))
;
// determine semantic.json config
if(answers.components) {

94
tasks/questions.js

@ -58,7 +58,7 @@ module.exports = {
value: 'yes'
},
{
name: 'Exit install',
name: 'Skip install',
value: 'no'
}
]
@ -88,49 +88,49 @@ module.exports = {
name: 'components',
message: 'What components should we include in the package? (Toggle with spacebar)',
choices: [
{ name: "Button", checked: true },
{ name: "Divider", checked: true },
{ name: "Flag", checked: true },
{ name: "Header", checked: true },
{ name: "Icon", checked: true },
{ name: "Image", checked: true },
{ name: "Input", checked: true },
{ name: "Label", checked: true },
{ name: "List", checked: true },
{ name: "Loader", checked: true },
{ name: "Rail", checked: true },
{ name: "Reveal", checked: true },
{ name: "Segment", checked: true },
{ name: "Step", checked: true },
{ name: "Breadcrumb", checked: true },
{ name: "Form", checked: true },
{ name: "Grid", checked: true },
{ name: "Menu", checked: true },
{ name: "Message", checked: true },
{ name: "Table", checked: true },
{ name: "Card", checked: true },
{ name: "Comment", checked: true },
{ name: "Feed", checked: true },
{ name: "Item", checked: true },
{ name: "Statistic", checked: true },
{ name: "Accordion", checked: true },
{ name: "Checkbox", checked: true },
{ name: "Dimmer", checked: true },
{ name: "Dropdown", checked: true },
{ name: "Modal", checked: true },
{ name: "Nag", checked: true },
{ name: "Popup", checked: true },
{ name: "Progress", checked: true },
{ name: "Rating", checked: true },
{ name: "Search", checked: true },
{ name: "Shape", checked: true },
{ name: "Sidebar", checked: true },
{ name: "Sticky", checked: true },
{ name: "Tab", checked: true },
{ name: "Transition", checked: true },
{ name: "Video", checked: true },
{ name: "Api", checked: true },
{ name: "Form ", checked: true }
{ name: "button", checked: true },
{ name: "divider", checked: true },
{ name: "flag", checked: true },
{ name: "header", checked: true },
{ name: "icon", checked: true },
{ name: "image", checked: true },
{ name: "input", checked: true },
{ name: "label", checked: true },
{ name: "list", checked: true },
{ name: "loader", checked: true },
{ name: "rail", checked: true },
{ name: "reveal", checked: true },
{ name: "segment", checked: true },
{ name: "step", checked: true },
{ name: "breadcrumb", checked: true },
{ name: "form", checked: true },
{ name: "grid", checked: true },
{ name: "menu", checked: true },
{ name: "message", checked: true },
{ name: "table", checked: true },
{ name: "card", checked: true },
{ name: "comment", checked: true },
{ name: "feed", checked: true },
{ name: "item", checked: true },
{ name: "statistic", checked: true },
{ name: "accordion", checked: true },
{ name: "checkbox", checked: true },
{ name: "dimmer", checked: true },
{ name: "dropdown", checked: true },
{ name: "modal", checked: true },
{ name: "nag", checked: true },
{ name: "popup", checked: true },
{ name: "progress", checked: true },
{ name: "rating", checked: true },
{ name: "search", checked: true },
{ name: "shape", checked: true },
{ name: "sidebar", checked: true },
{ name: "sticky", checked: true },
{ name: "tab", checked: true },
{ name: "transition", checked: true },
{ name: "video", checked: true },
{ name: "api", checked: true },
{ name: "form", checked: true }
],
when: when.notAuto
},
@ -181,7 +181,7 @@ module.exports = {
{
type: 'list',
name: 'cleanup',
message: 'Install Complete! Should we remove set-up files?',
message: 'Should we remove set-up files?',
choices: [
{
name: 'Yes (re-install will require redownloading semantic).',
@ -199,11 +199,11 @@ module.exports = {
message: 'Do you want to build Semantic now?',
choices: [
{
name: 'Yes, make those files',
name: 'Yes',
value: 'yes'
},
{
name: 'No, I\'ll do it later',
name: 'No',
value: 'no'
}
]

Loading…
Cancel
Save