Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Toolchain
sgc
Commits
aeff71c6
Commit
aeff71c6
authored
Jan 08, 2015
by
Philipp Nowinski
Browse files
[TASK] complete rewrite to match cgl
parent
e08bcc3f
Changes
9
Hide whitespace changes
Inline
Side-by-side
app/index.js
View file @
aeff71c6
...
...
@@ -4,20 +4,25 @@ var yeoman = require('yeoman-generator'),
yosay
=
require
(
'
yosay
'
),
path
=
require
(
'
path
'
);
module
.
exports
=
yeoman
.
generators
.
Base
.
extend
({
initializing
:
function
()
{
this
.
pkg
=
require
(
'
../package.json
'
);
},
module
.
exports
=
yeoman
.
generators
.
Base
.
extend
((
function
()
{
var
Generator
=
{},
answers
;
prompting
:
function
()
{
var
done
=
this
.
async
();
Generator
.
initializing
=
function
()
{
Generator
.
pkg
=
require
(
'
../package.json
'
);
};
// Have Yeoman greet the user.
Generator
.
prompting
=
function
()
{
var
done
=
this
.
async
(),
questions
;
// Greet the user
this
.
log
(
yosay
(
'
Welcome to the dandy
'
+
chalk
.
red
(
'
Sgalinski
'
)
+
'
generator!
'
));
var
prompts
=
[
// define questions
questions
=
[
{
type
:
'
list
'
,
name
:
'
projectType
'
,
...
...
@@ -42,55 +47,94 @@ module.exports = yeoman.generators.Base.extend({
name
:
'
projectName
'
,
message
:
'
Please enter the name for your project
'
,
default
:
process
.
cwd
().
split
(
path
.
sep
).
pop
()
},
{
type
:
'
input
'
,
name
:
'
cssPath
'
,
message
:
'
Please specify the path to the compiled css files
'
,
default
:
'
css
'
},
{
type
:
'
input
'
,
name
:
'
sassPath
'
,
message
:
'
Please specify the path to the sass source files
'
,
default
:
'
sass
'
},
{
type
:
'
input
'
,
name
:
'
javascriptPath
'
,
message
:
'
Please specify the path to the javascript files
'
,
default
:
'
javascript
'
},
{
type
:
'
input
'
,
name
:
'
compassConfigPath
'
,
message
:
'
Please specify the path to config.rb file for compass
'
,
default
:
'
.
'
},
{
type
:
'
input
'
,
name
:
'
imagesPath
'
,
message
:
'
Please specify the path to the images
'
,
default
:
'
images
'
}
];
this
.
prompt
(
prompts
,
function
(
props
)
{
this
.
projectType
=
props
.
projectType
;
this
.
projectName
=
props
.
projectName
;
// ask questions
this
.
prompt
(
questions
,
function
(
_answers
)
{
answers
=
_answers
;
done
();
}
.
bind
(
this
)
);
}
,
});
}
;
writing
:
{
app
:
function
()
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_package.json
'
),
this
.
destinationPath
(
'
package.json
'
),
{
projectName
:
this
.
projectName
}
);
this
.
fs
.
copy
(
this
.
templatePath
(
'
_bower.json
'
),
this
.
destinationPath
(
'
bower.json
'
)
);
},
Generator
.
writeGeneralConfigs
=
function
()
{
this
.
fs
.
copy
(
this
.
templatePath
(
'
_editorconfig
'
),
this
.
destinationPath
(
'
.editorconfig
'
)
);
this
.
fs
.
copy
(
this
.
templatePath
(
'
_jshintrc
'
),
this
.
destinationPath
(
'
.jshintrc
'
)
);
};
projectfiles
:
function
()
{
this
.
fs
.
copy
(
this
.
templatePath
(
'
editorconfig
'
),
this
.
destinationPath
(
'
.editorconfig
'
)
);
this
.
fs
.
copy
(
this
.
templatePath
(
'
jshintrc
'
),
this
.
destinationPath
(
'
.jshintrc
'
)
);
if
(
this
.
projectType
===
'
standalone
'
)
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_gulpfile.js
'
),
this
.
destinationPath
(
'
gulpfile.js
'
),
{
projectType
:
this
.
projectType
}
);
this
.
mkdir
(
'
Sass
'
);
this
.
mkdir
(
'
Images
'
);
this
.
mkdir
(
'
Scripts
'
);
}
}
},
Generator
.
writeGulp
=
function
()
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_gulpfile.js
'
),
this
.
destinationPath
(
'
gulpfile.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/settings.js
'
),
this
.
destinationPath
(
'
gulp/settings.js
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
gulp/css.js
'
),
this
.
destinationPath
(
'
gulp/css.js
'
),
answers
);
};
Generator
.
writeDependencyManagement
=
function
()
{
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_package.json
'
),
this
.
destinationPath
(
'
package.json
'
),
answers
);
this
.
fs
.
copyTpl
(
this
.
templatePath
(
'
_bower.json
'
),
this
.
destinationPath
(
'
bower.json
'
),
answers
);
};
install
:
function
()
{
Generator
.
install
=
function
()
{
this
.
installDependencies
({
skipInstall
:
this
.
options
[
'
skip-install
'
]
});
}
});
};
return
Generator
;
})());
app/templates/_config.rb
0 → 100644
View file @
aeff71c6
output_style
=
:expanded
relative_assets
=
true
line_comments
=
false
asset_cache_buster
:none
environment
=
:production
javascripts_dir
=
'<%= javascriptPath %>'
css_dir
=
'<%= cssPath %>'
sass_dir
=
'<%= sassPath %>'
images_dir
=
'<%= imagesPath %>'
cache_path
=
'/tmp/sass-cache/'
;
app/templates/editorconfig
→
app/templates/
_
editorconfig
View file @
aeff71c6
File moved
app/templates/_gulpfile.js
View file @
aeff71c6
...
...
@@ -2,40 +2,18 @@
var
gulp
=
require
(
'
gulp
'
),
path
=
require
(
'
path
'
),
compass
=
require
(
'
gulp-compass
'
),
autoprefixer
=
require
(
'
gulp-autoprefixer
'
),
cssImport
=
require
(
'
gulp-cssimport
'
),
minifyCss
=
require
(
'
gulp-minify-css
'
),
browserSync
=
require
(
'
browser-sync
'
),
imagemin
=
require
(
'
gulp-imagemin
'
),
jshint
=
require
(
'
gulp-jshint
'
),
argv
=
require
(
'
yargs
'
).
argv
,
<%
if
(
projectType
==
'
typo3Frontend
'
)
{
%>
argv
=
require
(
'
yargs
'
).
argv
<%
if
(
projectType
==
'
typo3Frontend
'
)
{
%>
extension
=
(
function
()
{
if
(
typeof
argv
.
ext
===
'
undefined
'
)
{
throw
new
Error
(
'
You have to specify the extension you want to work on with the --ext option.
'
);
}
return
argv
.
ext
;
}()),
<%
}
%>
extensionPath
=
path
.
join
(
'
typo3conf
'
,
'
ext
'
,
extension
),
sassPath
=
path
.
join
(
extensionPath
,
'
Resources
'
,
'
Public
'
,
'
Sass
'
),
cssPath
=
path
.
join
(
extensionPath
,
'
Resources
'
,
'
Public
'
,
'
StyleSheets
'
),
jsPath
=
path
.
join
(
extensionPath
,
'
Resources
'
,
'
Public
'
,
'
Scripts
'
),
imagePath
=
path
.
join
(
extensionPath
,
'
Resources
'
,
'
Public
'
,
'
Images
'
);
}())
<%
}
%>
;
gulp
.
task
(
'
css
'
,
function
()
{
return
gulp
.
src
(
sassPath
+
'
/**/*.scss
'
)
.
pipe
(
compass
({
config_file
:
path
.
join
(
extensionPath
,
'
config.rb
'
),
sourcemap
:
true
,
css
:
cssPath
,
sass
:
sassPath
}))
.
pipe
(
cssImport
())
.
pipe
(
autoprefixer
())
.
pipe
(
minifyCss
())
.
pipe
(
gulp
.
dest
(
cssPath
))
.
pipe
(
browserSync
.
reload
({
stream
:
true
}));
});
require
(
'
require-dir
'
)(
'
./gulp
'
);
gulp
.
task
(
'
jshint
'
,
function
()
{
return
gulp
.
src
(
jsPath
+
'
/**/*.js
'
)
...
...
app/templates/jshintrc
→
app/templates/
_
jshintrc
View file @
aeff71c6
File moved
app/templates/_package.json
View file @
aeff71c6
...
...
@@ -13,6 +13,7 @@
"gulp-minify-css"
:
"^0.3.11"
,
"gulp-imagemin"
:
"^2.1.0"
,
"gulp-jshint"
:
"^1.9.0"
,
"require-dir"
:
"^0.1.0"
,
"yargs"
:
"^1.3.3"
}
}
...
...
app/templates/gulp/css.js
0 → 100644
View file @
aeff71c6
'
use strict
'
;
var
gulp
=
require
(
'
gulp
'
),
settings
=
require
(
'
./settings
'
),
compass
=
require
(
'
gulp-compass
'
),
cssImport
=
require
(
'
gulp-cssimport
'
),
autoprefixer
=
require
(
'
gulp-autoprefixer
'
),
minifyCss
=
require
(
'
gulp-minify-css
'
);
// compile sass to css
gulp
.
task
(
'
css
'
,
function
()
{
return
gulp
.
src
(
settings
.
path
.
sass
+
'
/**/*.scss
'
)
.
pipe
(
compass
({
config_file
:
settings
.
path
.
compassConfig
,
sourcemap
:
true
,
css
:
settings
.
path
.
css
,
sass
:
settings
.
path
.
sass
}))
.
pipe
(
cssImport
())
.
pipe
(
autoprefixer
())
.
pipe
(
minifyCss
())
.
pipe
(
gulp
.
dest
(
settings
.
path
.
css
));
});
app/templates/gulp/settings.js
0 → 100644
View file @
aeff71c6
module
.
exports
=
{
path
:
{
css
:
'
<%= cssPath %>
'
,
sass
:
'
<%= sassPath %>
'
,
javascript
:
'
<%= javascriptPath %>
'
,
compassConfig
:
'
<%= compassConfigPath %>
'
}
};
test/test-app.js
View file @
aeff71c6
...
...
@@ -20,7 +20,7 @@ describe('sgalinski:app', function () {
assert
.
file
([
'
bower.json
'
,
'
package.json
'
,
'
.editorconfig
'
,
'
.
_
editorconfig
'
,
'
.jshintrc
'
]);
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment