Created by Menno Pietersen
@MennoPP - ThemesMODX - Any Screen Size
This presentation online http://goo.gl/i7Dxm3
You can use Git to install MODX
from the command line.
git clone http://github.com/modxcms/revolution.git
Or just install latest MODX the "normal" way
npm install gulp gulp-util [email protected] gulp-uglify gulp-rename gulp-minify-css gulp-notify gulp-concat browser-sync --save-dev
(We use gulp-sass version 0.7.1 for now becouse the latest version has a bug)
(at this time ElementHelper 2.0.0 is beta for MODX Revolution 2.3.1, it will be available via the MODX Package Manager at a later time)
Download the zip file and place it in:
(Becouse of a bug in the latest gulp-sass update,
we use gulp-sass version 0.7.1)
// npm install gulp gulp-util [email protected] gulp-uglify gulp-rename gulp-minify-css gulp-notify gulp-concat browser-sync --save-dev
// General settings for GULP
var gulp = require('gulp');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var notify = require('gulp-notify');
var minifycss = require('gulp-minify-css');
var concat = require('gulp-concat');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var paths = {
scss: './sass/*.scss'
};
// Get JS files and create a minified and unminified version
gulp.task('scripts', function() {
return gulp.src([
'js/app.js'
])
.pipe(concat('main.js'))
.pipe(gulp.dest('js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('js'));
});
// Get SASS files, convert to CSS and create a minified and unminified version
gulp.task('sass', function () {
gulp.src('scss/style.scss')
.pipe(sass({ style: 'expanded' }))
.pipe(gulp.dest('css'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('css'))
.pipe(reload({stream:true}));
});
// Reload all Browsers
gulp.task('bs-reload', function () {
browserSync.reload();
});
// Browser-Sync task
gulp.task('browser-sync', function() {
browserSync.init(["css/*.css", "js/*.js"], {
server: { baseDir: "./" }
// If you use vhosts use the line below and comment out the line above.
//proxy: "demo.local"
});
});
// Watch SCSS, js, tpl and html files, doing different things with each.
gulp.task('watch', ['sass', 'browser-sync'], function () {
// Watch SCSS files and run sass if any SCSS files change.
gulp.watch(["scss/*.scss"], ['sass'])
// Watch the app.js file and run scripts when it changes, after that refresh browser to see updated JS.
gulp.watch(["js/app.js"], ['scripts'])
// Watch the .tpl files in templates and chunks folder and run refresh browser to see updated Templates and Chunks.
gulp.watch(["elements/templates/*.tpl", "elements/chunks/*.tpl", "elements/templates/**/*.tpl", "elements/chunks/**/*.tpl"], ['bs-reload']);
});
Grab this file to get my quickstart files + folders.
Unzip in your project folder.
/assets/components/myproject/
In the Command Line (or Terminal) got to your project folder where your Gruntfile.js is and type: