Skip to content

Instantly share code, notes, and snippets.

@Flobin
Last active November 17, 2016 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Flobin/15ad080318081944f11163e01ab87cac to your computer and use it in GitHub Desktop.
Save Flobin/15ad080318081944f11163e01ab87cac to your computer and use it in GitHub Desktop.
too big
https://gist.github.com/Flobin/4b170694f5534d801405c50e1715a03b
_prelude.js:1Uncaught Error: Cannot find module './src/import'
at s (http://localhost:8000/static/articles/build/js/main.js:1:148)
at http://localhost:8000/static/articles/build/js/main.js:1:305
at http://localhost:8000/static/articles/build/js/main.js:14916:55
at Array.map (native)
at define (http://localhost:8000/static/articles/build/js/main.js:14903:33)
at Object.<anonymous> (http://localhost:8000/static/articles/build/js/main.js:18125:1)
at Object.5._process (http://localhost:8000/static/articles/build/js/main.js:18139:4)
at s (http://localhost:8000/static/articles/build/js/main.js:1:254)
at http://localhost:8000/static/articles/build/js/main.js:1:305
at Object.8.jquery (http://localhost:8000/static/articles/build/js/main.js:66223:14)
at s (http://localhost:8000/static/articles/build/js/main.js:1:254)
at e (http://localhost:8000/static/articles/build/js/main.js:1:425)
at http://localhost:8000/static/articles/build/js/main.js:1:443
articles
|-gulpfile.js
|-package.json
|-node_modules
| |-jquery
| |-tinymce
| |-pjax-api
| |-spica
| |-localsocket
|-build
| |-css
| |-img
|-src
| |-scripts
| | |-main.js
| |-styles
| |-images
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
cleancss = require('gulp-clean-css'),
// jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
// concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
livereload = require('gulp-livereload'),
del = require('del'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
sourcemaps = require('gulp-sourcemaps'),
gutil = require('gulp-util'),
babelify = require('babelify');
gulp.task('styles', function() {
return gulp.src(['src/styles/main.scss','src/styles/tinymce.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest('build/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cleancss())
.pipe(gulp.dest('build/css'))
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('scripts', function () {
var b = browserify({
entries: ['src/scripts/modernizr.js', 'src/scripts/main.js'],
debug: true
}).transform(babelify, { presets: ["latest"] });
return b.bundle()
.pipe(source('main.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
// .pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('build/js/'));
});
gulp.task('images', function() {
return gulp.src('src/images/**/*')
.pipe(cache(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true })))
.pipe(gulp.dest('build/img'))
.pipe(notify({ message: 'Images task complete' }));
});
gulp.task('clean', function() {
return del(['build/css', 'build/js', 'build/img']);
});
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts', 'images');
});
gulp.task('watch', function() {
// Watch .scss files
gulp.watch('src/styles/**/*.scss', ['styles']);
// Watch .js files
gulp.watch('src/scripts/**/*.js', ['scripts']);
// Watch image files
gulp.watch('src/images/**/*', ['images']);
// Create LiveReload server
livereload.listen();
// Watch any files in dist/, reload on change
gulp.watch(['build/**']).on('change', livereload.changed);
});
{
"name": "togethere",
"version": "1.0.0",
"description": "a crowd-sourced travel guide",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/togethere-com/togethere.git"
},
"author": "Robin Berghuijs",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/togethere-com/togethere/issues"
},
"homepage": "https://github.com/togethere-com/togethere#readme",
"devDependencies": {
"babel-preset-latest": "^6.16.0",
"babelify": "^7.3.0",
"del": "^2.2.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-cache": "^0.4.5",
"gulp-clean-css": "^2.0.11",
"gulp-concat": "^2.6.0",
"gulp-imagemin": "^3.0.1",
"gulp-jshint": "^2.0.1",
"gulp-livereload": "^3.8.1",
"gulp-notify": "^2.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-uglify": "^1.5.4",
"jshint": "^2.9.2",
"pjax": "^0.2.4",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"vinyl-transform": "^1.0.0"
},
"dependencies": {
"browserify": "^13.1.1",
"gulp-sourcemaps": "^2.2.0",
"gulp-util": "^3.0.7",
"jquery": "^3.1.1",
"localsocket": "^0.4.11",
"pjax-api": "^3.3.6",
"spica": "0.0.40",
"tinymce": "^4.4.3",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"vinyl-transform": "^1.0.0"
},
"browserify": {
"transform": [
[
"babelify",
{
"presets": [
"latest"
]
}
]
]
}
}
var $ = require('jquery');
import tinymce from 'tinymce/tinymce';
import 'tinymce/themes/modern/theme';
import 'spica';
import 'localsocket';
import Pjax from 'pjax-api';
function DOMContentLoaded() {
var $e = $('.tinymce'),
id_text = document.getElementById('id_text');
if (id_text) {
id_text.removeAttribute("required");
}
// .tinymce element is not present on all pages so check for it
if ($e.length != 0) {
if ($e.data('mce-conf').length != 0) {
var tinymceConf = $e.data('mce-conf');
} else {
var tinymceConf = {
selector: ".tinymce",
theme: "inlite",
inline: true,
toolbar: "undo redo | bold italic | bullist numlist | blockquote | removeformat",
menubar: false,
statusbar: false,
schema: "html5",
max_height: 500,
max_width: 500,
min_height: 100,
min_width: 400,
content_css: '/static/articles/build/css/tinymce.css',
}
}
tinymce.remove();
tinymce.init(tinymceConf);
}
var filterFormButton = document.getElementById('filter-form-reset-button');
if (filterFormButton) {
filterFormButton.addEventListener('click', function (event) {
event.preventDefault();
var filterForm = document.getElementById('filter-form'),
inputs = filterForm.getElementsByTagName('input');
Array.prototype.forEach.call(inputs, function(input) {
if (input.type==='checkbox') {
input.checked = false;
}
});
// TODO maybe not submit yet?
filterForm.submit();
});
}
}
DOMContentLoaded();
new Pjax({
areas: ['.content', '.sidebar--left', '.sidebar--right'],
form: '#filter-form'
});
document.addEventListener('pjax:load', DOMContentLoaded);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment