Commit 634cb7a1 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] remove compass deps

parent 5db69cc1
......@@ -58,13 +58,13 @@ module.exports = yeoman.generators.Base.extend((function() {
value: 'extbaseExtension',
name: 'TYPO3 Extbase Extension'
},
{
value: 'standalone',
name: 'Standalone Frontend Project'
},
{
value: 'typo3Frontend',
name: 'TYPO3 Frontend Setup'
},
{
value: 'standalone',
name: 'Standalone Frontend Project'
}
]
},
......@@ -122,19 +122,6 @@ module.exports = yeoman.generators.Base.extend((function() {
cssPrompts: function() {
var done = this.async();
this.prompt([
{
type: 'confirm',
name: 'compass',
message: 'Do you want to include compass?',
default: false
},
{
when: function(answers) { return answers.compass; },
type: 'input',
name: 'compassConfigPath',
message: 'Please specify the path to config.rb file for compass',
default: '.'
},
{
when: function() { return answers.projectType !== 'extbaseExtension'; },
type: 'confirm',
......@@ -217,14 +204,16 @@ module.exports = yeoman.generators.Base.extend((function() {
};
Generator.writeGeneralConfigs = function() {
this.fs.copy(
this.templatePath('_editorconfig'),
this.destinationPath('.editorconfig')
);
this.fs.copy(
this.templatePath('_jshintrc'),
this.destinationPath('.jshintrc')
);
if (answers.projectType !== 'extbaseExtension') {
this.fs.copy(
this.templatePath('_editorconfig'),
this.destinationPath('.editorconfig')
);
this.fs.copy(
this.templatePath('_jshintrc'),
this.destinationPath('.jshintrc')
);
}
};
Generator.writeGulp = function() {
......@@ -264,16 +253,6 @@ module.exports = yeoman.generators.Base.extend((function() {
}
};
Generator.writeCompassConfig = function() {
if (answers.projectType !== 'typo3Frontend' && answers.compass) {
this.fs.copyTpl(
this.templatePath('_config.rb'),
this.destinationPath(answers.compassConfigPath + '/config.rb'),
answers
);
}
};
Generator.writeHtml = function() {
if (answers.projectType === 'standalone') {
this.fs.copyTpl(
......
{
"css": "<%= cssPath %>",
"sass": "<%= sassPath %>",
"javascript": "<%= javascriptPath %>",<% if (compass) { %>
"compassConfig": "<%= compassConfigPath %>",<% } %>
"javascript": "<%= javascriptPath %>",
"images": "<%= imagesPath %>"
}
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/';
......@@ -8,9 +8,9 @@
"browser-sync": "^1.8.2",<% } else if (livereloadMethod === 'livereload') { %>
"gulp-livereload": "^3.2.0",<% } %>
"gulp": "^3.8.10",
"gulp-autoprefixer": "^2.0.0",<% if (compass) { %>
"gulp-compass": "^2.0.3",<% } else { %>
"gulp-sass": "^1.3.1",<% } %>
"gulp-autoprefixer": "^2.0.0",
"gulp-css-image-dimensions": "^1.0.1",
"gulp-sass": "^1.3.1",
"gulp-cssimport": "^1.3.1",<% if (minifyCss) { %>
"gulp-minify-css": "^0.3.11",<% } %>
"gulp-imagemin": "^2.1.0",
......
'use strict';
var gulp = require('gulp'),
settings = require('./settings'),<% if (compass) { %>
compass = require('gulp-compass'),<% } else { %>
sass = require('gulp-sass'),<% } %>
settings = require('./settings'),
sass = require('gulp-sass'),
cssImageDimensions = require('gulp-css-image-dimensions'),
cssImport = require('gulp-cssimport'),
autoprefixer = require('gulp-autoprefixer')<% if (minifyCss) { %>,
minifyCss = require('gulp-minify-css')<% } %><% if (livereloadMethod === 'browserSync') { %>,
......@@ -11,17 +11,29 @@ var gulp = require('gulp'),
// compile sass to css
gulp.task('css', function() {
return gulp.src(settings.path.sass + '/**/*.scss')<% if (compass) { %>
.pipe(compass({
config_file: settings.path.compassConfig + '/config.rb',
sourcemap: true,
css: settings.path.css,
sass: settings.path.sass
}))<% } else { %>
.pipe(sass())<% } %>
return gulp.src(settings.path().sass + '/**/*.scss')
.pipe(cssImageDimensions('../images'))
.pipe(sass())
.pipe(cssImport())
.pipe(autoprefixer(<%= autoprefixerBrowserSelection %>))<% if (minifyCss) { %>
.pipe(minifyCss())<% } %>
.pipe(gulp.dest(settings.path.css))<% if (livereloadMethod === 'browserSync') { %>
.pipe(gulp.dest(settings.path().css))<% if (livereloadMethod === 'browserSync') { %>
.pipe(browserSync.reload({stream: true}))<% } %>;
});
gulp.task('sprites', function() {
return gulp.src(path.join(settings.path(), '/images/sprites') + '/*.png')
.pipe(tap(function() {
del([path.join(settings.path(), 'images/') + 'sprites-*.png']);
}))
.pipe(sprite({
name: 'sprites',
style: '_sprite.scss',
cssPath: '../images',
template: 'gulp/sprite-scss-template.mustache',
orientation: 'binary-tree',
hash: true
}))
.pipe(imagemin())
.pipe(gulpif('*.png', gulp.dest(path.join(settings.path(), 'images')), gulp.dest(path.join(settings.path(), 'sass'))));
});
......@@ -5,10 +5,10 @@ var gulp = require('gulp'),
imagemin = require('gulp-imagemin');
gulp.task('images', function() {
return gulp.src(settings.path.images + '/**/*')
return gulp.src(settings.path().images + '/**/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}]
}))
.pipe(gulp.dest(settings.path.images));
.pipe(gulp.dest(settings.path().images));
});
......@@ -11,28 +11,28 @@ var gulp = require('gulp'),
browserSync = require('browser-sync')<% } %>;
gulp.task('jshint', function() {
return gulp.src([settings.path.javascript + '/**/*.js', '!' + settings.path.javascript + '/**/*.min.js'])
return gulp.src([settings.path().javascript + '/**/*.js', '!' + settings.path().javascript + '/**/*.min.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('javascript', function() {
<% if (browserify) { %>
gulp.src([settings.path.javascript + '/**/*.js', '!' + settings.path.javascript + '/**/*.min.js'])
gulp.src([settings.path().javascript + '/**/*.js', '!' + settings.path().javascript + '/**/*.min.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
return browserify('./' + settings.path.javascript + '/main.js')
return browserify('./' + settings.path().javascript + '/main.js')
.bundle()
.pipe(source(<% if (jsuglify) { %>'main.min.js'<% } else { %>'main.js'<% } %>))
.pipe(buffer())<% if (jsuglify) { %>
.pipe(uglify())<% } %>
.pipe(gulp.dest('./' + settings.path.javascript))
.pipe(gulp.dest('./' + settings.path().javascript))
<% } else { %>
return gulp.src([settings.path.javascript + '/**/*.js', '!' + settings.path.javascript + '/**/*.min.js'])
return gulp.src([settings.path().javascript + '/**/*.js', '!' + settings.path().javascript + '/**/*.min.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))<% if (jsconcat) { %>
.pipe(concat(<% if (jsuglify) { %>'main.min.js'<% } else { %>'main.js'<% } %>))<% } %><% if (jsuglify) { %>
.pipe(uglify())<% } %>
.pipe(gulp.dest('./' + settings.path.javascript + '/'))<% } %><% if (livereloadMethod === 'browserSync') { %>
.pipe(gulp.dest('./' + settings.path().javascript + '/'))<% } %><% if (livereloadMethod === 'browserSync') { %>
.pipe(browserSync.reload({stream: true}))<% } %>;
});
......@@ -5,7 +5,7 @@ module.exports = (function() {
var argv = require('yargs').argv,
path = require('path'),
chalk = require('chalk'),
extension = (function() {
extension = function() {
if (typeof argv.ext === 'undefined') {
throw new Error(
chalk.red('You have to specify the extension you want to work on with the') +
......@@ -14,28 +14,37 @@ module.exports = (function() {
);
}
return argv.ext;
}()),
extensionPath = path.join('typo3conf', 'ext', extension),
assetPaths = require('../' + path.join(extensionPath, 'asset-paths.json'));
},
extensionPath = function() {
return path.join('typo3conf', 'ext', extension());
},
assetPaths = function() {
return require('../' + path.join(extensionPath(), 'asset-paths.json'));
};
return {
path: {
css: path.join(extensionPath, assetPaths.css),
sass: path.join(extensionPath, assetPaths.sass),
javascript: path.join(extensionPath, assetPaths.javascript),<% if (compass) { %>
compassConfig: path.join(extensionPath, assetPaths.compassConfig),<% } %>
images: path.join(extensionPath, assetPaths.images)
path: function() {
return {
css: path.join(extensionPath(), assetPaths().css),
sass: path.join(extensionPath(), assetPaths().sass),
javascript: path.join(extensionPath(), assetPaths().javascript),
images: path.join(extensionPath(), assetPaths().images)
};
},
setExtension: function(ext) {
extension = function(){return ext;};
}
};
})();
<% } else { %>
module.exports = {
path: {
css: '<%= cssPath %>',
sass: '<%= sassPath %>',
javascript: '<%= javascriptPath %>',<% if (compass) { %>
compassConfig: '<%= compassConfigPath %>',<% } %>
images: '<%= imagesPath %>'
path: function() {
return {
css: '<%= cssPath %>',
sass: '<%= sassPath %>',
javascript: '<%= javascriptPath %>',
images: '<%= imagesPath %>'
};
}
};
<% } %>
......@@ -2,6 +2,5 @@
"css": "css",
"sass": "sass",
"javascript": "js",
"compassConfig": ".",
"images": "imgs"
}
module.exports = {
path: {
css: 'css',
sass: 'sass',
javascript: 'js',
compassConfig: '.',
images: 'imgs'
path: function() {
return {
css: 'css',
sass: 'sass',
javascript: 'js',
images: 'imgs'
};
}
};
......@@ -18,7 +18,6 @@ describe('sgalinski generator:standalone:bower', function() {
cssPath: 'css',
sassPath: 'sass',
javascriptPath: 'js',
compassConfigPath: '.',
imagesPath: 'imgs',
autoprefixerBrowserSelection: '\'last 1 version\''
})
......@@ -44,7 +43,6 @@ describe('sgalinski generator:standalone:withoutBower', function() {
cssPath: 'css',
sassPath: 'sass',
javascriptPath: 'js',
compassConfigPath: '.',
imagesPath: 'imgs',
autoprefixerBrowserSelection: '\'last 1 version\'',
bower: false
......@@ -71,7 +69,6 @@ describe('sgalinski generator:typo3-frontend:bower', function() {
cssPath: 'css',
sassPath: 'sass',
javascriptPath: 'js',
compassConfigPath: '.',
imagesPath: 'imgs',
autoprefixerBrowserSelection: '\'last 1 version\'',
bower: true
......
......@@ -18,21 +18,18 @@ describe('sgalinski generator:extbase-extension', function() {
cssPath: 'css',
sassPath: 'sass',
javascriptPath: 'js',
compassConfigPath: '.',
imagesPath: 'imgs',
compass: true
imagesPath: 'imgs'
})
.on('end', done);
});
it('creates config files', function() {
assert.file([
'config.rb',
'.editorconfig',
'.jshintrc',
'asset-paths.json'
]);
assert.noFile([
'.editorconfig',
'.jshintrc',
'package.json',
'bower.json'
]);
......
......@@ -18,10 +18,8 @@ describe('sgalinski generator:standalone', function() {
cssPath: 'css',
sassPath: 'sass',
javascriptPath: 'js',
compassConfigPath: '.',
imagesPath: 'imgs',
autoprefixerBrowserSelection: '\'last 1 version\'',
compass: true
autoprefixerBrowserSelection: '\'last 1 version\''
})
.on('end', done);
});
......@@ -29,7 +27,6 @@ describe('sgalinski generator:standalone', function() {
it('creates config files', function() {
assert.file([
'bower.json',
'config.rb',
'.editorconfig',
'.jshintrc',
'package.json'
......
......@@ -4,7 +4,7 @@ module.exports = (function() {
var argv = require('yargs').argv,
path = require('path'),
chalk = require('chalk'),
extension = (function() {
extension = function() {
if (typeof argv.ext === 'undefined') {
throw new Error(
chalk.red('You have to specify the extension you want to work on with the') +
......@@ -13,17 +13,25 @@ module.exports = (function() {
);
}
return argv.ext;
}()),
extensionPath = path.join('typo3conf', 'ext', extension),
assetPaths = require('../' + path.join(extensionPath, 'asset-paths.json'));
},
extensionPath = function() {
return path.join('typo3conf', 'ext', extension());
},
assetPaths = function() {
return require('../' + path.join(extensionPath(), 'asset-paths.json'));
};
return {
path: {
css: path.join(extensionPath, assetPaths.css),
sass: path.join(extensionPath, assetPaths.sass),
javascript: path.join(extensionPath, assetPaths.javascript),
compassConfig: path.join(extensionPath, assetPaths.compassConfig),
images: path.join(extensionPath, assetPaths.images)
path: function() {
return {
css: path.join(extensionPath(), assetPaths().css),
sass: path.join(extensionPath(), assetPaths().sass),
javascript: path.join(extensionPath(), assetPaths().javascript),
images: path.join(extensionPath(), assetPaths().images)
};
},
setExtension: function(ext) {
extension = function(){return ext;};
}
};
})();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment