This repository has been archived by the owner on Jun 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5696de3
commit 2f95e70
Showing
57 changed files
with
6,359 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,6 @@ | |
/node_modules | ||
/web/vendor | ||
|
||
**/.sass-cache/* | ||
|
||
app/config/_set_env_vars.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,111 @@ | ||
// Gruntfile.js | ||
module.exports = function(grunt) { | ||
grunt.loadNpmTasks('grunt-symlink'); | ||
grunt.loadNpmTasks('grunt-contrib-less'); | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
// Création du répertoire d'image pour l'application s'il n'existe pas. | ||
grunt.file.mkdir('app/Resources/public/images/'); | ||
|
||
// properties are css files | ||
// values are less files | ||
var filesLess = {}; | ||
|
||
// Configuration du projet | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
// Définition de la tache 'less' | ||
// https://github.com/gruntjs/grunt-contrib-less | ||
less: { | ||
bundles: { | ||
options: { | ||
compress: true, | ||
yuicompress: true, | ||
optimization: 2 | ||
grunt.initConfig({ | ||
// Définition de la tache 'symlink' | ||
// https://github.com/gruntjs/grunt-contrib-symlink | ||
symlink: { | ||
// app/Resources/public/ doit être disponible via web/bundles/app/ | ||
app: { | ||
dest: 'web/bundles/app', | ||
relativeSrc: '../../app/Resources/public/', | ||
options: {type: 'dir'} | ||
} | ||
}, | ||
files: filesLess | ||
} | ||
}, | ||
// Définition de la tache 'symlink' | ||
// https://github.com/gruntjs/grunt-contrib-symlink | ||
symlink: { | ||
// app/Resources/public/ doit être disponible via web/bundles/app/ | ||
app: { | ||
dest: 'web/bundles/app', | ||
relativeSrc: '../../app/Resources/public/', | ||
options: {type: 'dir'} | ||
} | ||
}, | ||
concat: { | ||
dist: { | ||
src: [ | ||
'web/vendor/jquery/dist/jquery.js', | ||
'web/vendor/bootstrap/js/transition.js', | ||
'web/vendor/bootstrap/js/alert.js', | ||
'web/vendor/bootstrap/js/modal.js', | ||
'web/vendor/bootstrap/js/dropdown.js', | ||
'web/vendor/bootstrap/js/scrollspy.js', | ||
'web/vendor/bootstrap/js/tab.js', | ||
'web/vendor/bootstrap/js/tooltip.js', | ||
'web/vendor/bootstrap/js/popover.js', | ||
'web/vendor/bootstrap/js/button.js', | ||
'web/vendor/bootstrap/js/collapse.js', | ||
'web/vendor/bootstrap/js/carousel.js', | ||
'web/vendor/bootstrap/js/typeahead.js', | ||
'web/vendor/bootstrap/js/affix.js', | ||
'web/bundles/app/js/main.js' | ||
], | ||
dest: 'web/built/app/js/main.js' | ||
} | ||
}, | ||
// Lorsque l'on modifie des fichiers LESS, il faut relancer la tache 'css' | ||
// Lorsque l'on modifie des fichiers JS, il faut relancer la tache 'javascript' | ||
watch: { | ||
css: { | ||
files: ['web/bundles/*/less/*.less'], | ||
tasks: ['css'] | ||
}, | ||
javascript: { | ||
files: ['web/bundles/app/js/*.js'], | ||
tasks: ['javascript'] | ||
} | ||
}, | ||
uglify: { | ||
dist: { | ||
files: { | ||
'web/built/app/js/main.min.js': ['web/built/app/js/main.js'] | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// Default task(s). | ||
grunt.registerTask('default', ['css', 'javascript']); | ||
grunt.registerTask('css', ['less:discovering', 'less']); | ||
grunt.registerTask('javascript', ['concat', 'uglify']); | ||
grunt.registerTask('assets:install', ['symlink']); | ||
grunt.registerTask('deploy', ['assets:install', 'default']); | ||
grunt.registerTask('less:discovering', 'This is a function', function() { | ||
// LESS Files management | ||
// Source LESS files are located inside : bundles/[bundle]/less/ | ||
// Destination CSS files are located inside : built/[bundle]/css/ | ||
var mappingFileLess = grunt.file.expandMapping( | ||
['*/less/*.less', '*/less/*/*.less'], | ||
'web/built/', { | ||
cwd: 'web/bundles/', | ||
rename: function(dest, matchedSrcPath, options) { | ||
return dest + matchedSrcPath.replace(/less/g, 'css'); | ||
sass: { | ||
// this is the "production" Sass config used with the "grunt buildcss" command | ||
dist: { | ||
options: { | ||
style: 'compressed', | ||
loadPath: 'web/vendor/bootstrap-sass/assets/stylesheets' | ||
}, | ||
files: { | ||
'web/built/app/css/main.css': 'web/bundles/app/scss/main.sass' | ||
} | ||
} | ||
}, | ||
coffee: { | ||
compile: { | ||
options: { | ||
join: true | ||
}, | ||
files: { | ||
'web/bundles/tmp/main.js': ['web/bundles/app/coffee/*.coffee'] | ||
} | ||
} | ||
}, | ||
// configure the "grunt watch" task | ||
watch: { | ||
sass: { | ||
files: 'web/bundles/app/scss/*.sass', | ||
tasks: ['buildcss'] | ||
}, | ||
coffee: { | ||
files: 'web/bundles/app/coffee/*.coffee', | ||
tasks: ['buildjs'] | ||
} | ||
}, | ||
// concat | ||
concat: { | ||
js: { | ||
src: [ | ||
'web/vendor/jquery/dist/jquery.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/transition.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/alert.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/modal.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/scrollspy.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/tab.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/popover.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/button.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/collapse.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/carousel.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/typeahead.js', | ||
'web/vendor/bootstrap-sass/assets/javascripts/bootstrap/affix.js', | ||
'web/vendor/photoswipe/dist/photoswipe.js', | ||
'web/bundles/tmp/modernizr-custom.js', | ||
'web/bundles/tmp/main.js' | ||
], | ||
dest: 'web/built/app/js/main.js' | ||
}, | ||
css: { | ||
src: [ | ||
'web/built/app/css/main.css', | ||
'web/vendor/photoswipe/dist/photoswipe.css' | ||
], | ||
dest: 'web/built/app/css/main.min.css' | ||
} | ||
}, | ||
// minify | ||
uglify: { | ||
dist: { | ||
files: { | ||
'web/built/app/js/main.min.js': ['web/built/app/js/main.js'] | ||
} | ||
} | ||
}, | ||
modernizr: { | ||
dist: { | ||
"dest" : "web/bundles/tmp/modernizr-custom.js", | ||
"crawl" : false, | ||
"options": [ | ||
"setClasses" | ||
], | ||
"uglify": true, | ||
"tests" : ['svg'] | ||
} | ||
} | ||
}); | ||
|
||
grunt.util._.each(mappingFileLess, function(value) { | ||
// Why value.src is an array ?? | ||
filesLess[value.dest] = value.src[0]; | ||
}); | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-symlink'); | ||
grunt.loadNpmTasks('grunt-contrib-sass'); | ||
grunt.loadNpmTasks('grunt-contrib-coffee'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks("grunt-modernizr"); | ||
|
||
grunt.registerTask('default', ['buildcss', 'buildjs']); | ||
grunt.registerTask('buildcss', ['sass:dist', 'concat:css']); | ||
grunt.registerTask('buildjs', ['modernizr:dist', 'coffee:compile', 'concat:js', 'uglify']); | ||
grunt.registerTask('assets:install', ['symlink']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
], | ||
"dependencies": { | ||
"jquery": "2.1.3", | ||
"bootstrap": "3.3.5" | ||
"bootstrap-sass": "3.3.1", | ||
"photoswipe": "4.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/AppBundle/Resources/public/coffee/construct-tim.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# default | ||
|
||
$(document).ready -> | ||
|
||
# svg fallback | ||
if !Modernizr.svg | ||
imgs = $('img[data-fallback]') | ||
imgs.attr 'src', imgs.data('fallback') | ||
|
||
# svg replace | ||
jQuery('img.svg-replace').each -> | ||
$img = jQuery(this) | ||
imgID = $img.attr('id') | ||
imgClass = $img.attr('class') | ||
imgURL = $img.attr('src') | ||
jQuery.get imgURL, ((data) -> | ||
# Get the SVG tag, ignore the rest | ||
$svg = jQuery(data).find('svg') | ||
# Add replaced image's ID to the new SVG | ||
if typeof imgID != 'undefined' | ||
$svg = $svg.attr('id', imgID) | ||
# Add replaced image's classes to the new SVG | ||
if typeof imgClass != 'undefined' | ||
$svg = $svg.attr('class', imgClass + ' replaced-svg') | ||
# Remove any invalid XML tags as per http://validator.w3.org | ||
$svg = $svg.removeAttr('xmlns:a') | ||
# Replace image with new SVG | ||
$btn = jQuery "<div class='replaced-svg-container'>" | ||
$btn.append $svg | ||
$img.parent().prepend $btn | ||
$img.hide() | ||
return | ||
), 'xml' | ||
return |
Oops, something went wrong.