Commit 08c4694e authored by Nicolas Joyard's avatar Nicolas Joyard Committed by Jamesie Pic

Get rid of gulp, use lesscpy for LESS stylesheets

parent 08fbac1d
......@@ -6,10 +6,6 @@ core/static/libs/*
static/libs
node_modules
# compiled css
static/stylesheets/*.min.css
# settings
memopol/config.json
......
......@@ -41,11 +41,12 @@ CI=true
npm install bower
npm install
node_modules/.bin/bower install
node_modules/gulp/bin/gulp.js less
mkdir -p wsgi
./manage.py collectstatic --noinput
./manage.py compress
popd
mkdir -p ${OPENSHIFT_DATA_DIR}media
mkdir -p ${OPENSHIFT_REPO_DIR}wsgi/static/media
ln -sf ${OPENSHIFT_DATA_DIR}media ${OPENSHIFT_REPO_DIR}wsgi/static/media
ln -sf ${OPENSHIFT_DATA_DIR}compress/CACHE ${OPENSHIFT_REPO_DIR}wsgi/static/collected/CACHE
......@@ -10,13 +10,11 @@ install:
before_script:
- npm install -g bower
- bower install
- npm install
script:
- pep8 . --exclude '*/migrations,docs' --ignore E128
- flake8 . --exclude '*/migrations,docs' --ignore E128
- django-admin migrate
- django-admin update_score
- node_modules/gulp/bin/gulp.js less
deploy:
- provider: openshift
user: jamespic@gmail.com
......
......@@ -11,9 +11,10 @@
{% load compress %}
{% load staticfiles %}
{% compress css %}
<link rel="stylesheet" href="{% static 'stylesheets/libs.min.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'stylesheets/base.min.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'libs/bootstrap/dist/css/bootstrap.min.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'libs/fontawesome/css/font-awesome.min.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'libs/flag-icon-css/css/flag-icon.min.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'less/base.less' %}" type="text/less" />
{% endcompress %}
{% compress js %}
<script type="text/javascript" src="{% static 'libs/jquery/dist/jquery.js' %}"></script>
......
......@@ -101,17 +101,6 @@ Then, install the bower packages::
jquery#2.1.4 static/libs/jquery
Build the static files with gulp::
$ node_modules/gulp/bin/gulp.js less
[22:26:42] Using gulpfile /tmp/political_memory/gulpfile.js
[22:26:42] Starting 'less'...
[22:26:44] Finished 'less' after 1.54 s
.. note:: The ``node_modules/gulp/bin/gulp.js watch`` command may be used to
have gulp watching for changes and rebuilding static files
automatically.
Activate ``DJANGO_DEBUG``
=========================
......
var gulp = require('gulp');
var less = require('gulp-less');
var watch = require('gulp-watch');
var minifycss = require('gulp-minify-css');
var rename = require('gulp-rename');
var gzip = require('gulp-gzip');
var livereload = require('gulp-livereload');
var gzip_options = {
threshold: '1kb',
gzipOptions: {
level: 9
}
};
var less_src = ['static/less/base.less', 'static/less/libs.less'];
/* Compile Our Sass */
gulp.task('less', function() {
return gulp.src(less_src)
.pipe(less())
.pipe(gulp.dest('static/stylesheets'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('static/stylesheets'))
// .pipe(gzip(gzip_options))
// .pipe(gulp.dest('static/stylesheets'))
.pipe(livereload());
});
/* Watch Files For Changes */
gulp.task('watch', function() {
livereload.listen();
gulp.watch('static/less/*.less', ['less']);
/* Trigger a live reload on any Django template changes */
gulp.watch('**/templates/*').on('change', livereload.changed);
});
gulp.task('default', ['less', 'watch']);
......@@ -172,6 +172,7 @@ COMPRESS_ROOT = 'static/'
if DATA_DIR:
MEDIA_URL = '/static/media/'
MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
COMPRESS_ROOT = os.path.join(DATA_DIR, 'compress')
if PUBLIC_DIR:
STATIC_URL = '/static/collected/'
......@@ -218,11 +219,16 @@ STATICFILES_FINDERS = (
# Use compressor even in debug
COMPRESS_ENABLED = False
if os.environ.get('OPENSHIFT_LOG_DIR', None):
# Enable offline compression on openshift
COMPRESS_ENABLED = True
COMPRESS_OFFLINE = True
COMPRESS_PRECOMPILERS = (
# ('text/coffeescript', 'coffee --compile --stdio'),
('text/less', 'lessc {infile} {outfile}'),
('text/x-sass', 'sass {infile} {outfile}'),
('text/x-scss', 'sass --scss {infile} {outfile}'),
('text/less', 'lesscpy {infile}'),
# ('text/x-sass', 'sass {infile} {outfile}'),
# ('text/x-scss', 'sass --scss {infile} {outfile}'),
# ('text/stylus', 'stylus < {infile} > {outfile}'),
# ('text/foobar', 'path.to.MyPrecompilerFilter'),
)
......
{
"name": "memopol",
"version": "3.0.0",
"description": "git clone git@github.com:political-memory/django-representatives-votes.git git clone git@github.com:political-memory/django-representatives.git git clone git@github.com:political-memory/political_memory.git",
"main": "manage.py",
"dependencies": {
"gulp-livereload": "^3.8.0",
"gulp-gzip": "^1.1.0",
"gulp-less": "^3.0.3",
"gulp-minify-css": "^1.2.0",
"gulp-rename": "^1.2.2",
"gulp-watch": "^4.3.1",
"gulp": "^3.9.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@git.laquadrature.net:memopol/memopol.git"
},
"author": "",
"license": "ISC"
}
......@@ -23,6 +23,7 @@ setup(name='political-memory',
'django>=1.8,<1.9',
'hamlpy>=0.82,<0.83',
'ijson>=2.2,<2.3',
'lesscpy',
'python-dateutil>=2.4,<2.5',
'pytz==2015.7',
'django-suit',
......
@import '../libs/bootstrap/less/bootstrap';
@import '../libs/fontawesome/less/font-awesome';
// Flag icons
@import '../libs/flag-icon-css/less/variabless';
@flag-icon-css-path: '../libs/flag-icon-css/flags';
@import '../libs/flag-icon-css/less/flag-icon-base';
@import '../libs/flag-icon-css/less/flag-icon-list';
@font-face {
font-family: 'propagandaregular';
src: url('../fonts/propagan-webfont.eot');
src: url('../fonts/propagan-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/propagan-webfont.woff') format('woff'), url('../fonts/propagan-webfont.ttf') format('truetype'), url('../fonts/propagan-webfont.svg#propagandaregular') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'sansus_webissimoitalic';
src: url('../fonts/sansus_webissimo-italic-webfont-webfont.eot');
src: url('../fonts/sansus_webissimo-italic-webfont-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/sansus_webissimo-italic-webfont-webfont.woff') format('woff'), url('../fonts/sansus_webissimo-italic-webfont-webfont.ttf') format('truetype'), url('../fonts/sansus_webissimo-italic-webfont-webfont.svg#sansus_webissimoitalic') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'sansus_webissimoregular';
src: url('../fonts/sansus_webissimo-regular-webfont-webfont.eot');
src: url('../fonts/sansus_webissimo-regular-webfont-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/sansus_webissimo-regular-webfont-webfont.woff') format('woff'), url('../fonts/sansus_webissimo-regular-webfont-webfont.ttf') format('truetype'), url('../fonts/sansus_webissimo-regular-webfont-webfont.svg#sansus_webissimoregular') format('svg');
font-weight: normal;
font-style: normal;
}
#header {
background: #5B8EDC;
color: white;
}
#header h1 {
font-family: 'propagandaregular';
margin: 0;
padding-top: 20px;
}
#header a {
color: white;
text-decoration: none;
}
#header .organization {
font-style: italic;
}
#nav {
padding: 0;
}
#nav ul.nav {
clear: both;
display: flex;
font-weight: bold;
border-bottom: #eee 1px solid;
}
#logo {
float: left;
}
#logo img {
width: 100px;
}
#footer {
background: #5B8EDC;
color: white;
text-align: center;
padding: 20px;
}
#footer a {
color: white;
text-decoration: underline;
}
.pagination-block {
margin-bottom: 10px;
color: #999;
font-size: 0.9em;
}
.pagination-block nav {
text-align: center;
}
.pagination-block .count {
text-align: left;
}
table.detail-view > tbody > tr > td,
table.detail-view > tbody > tr > th {
border-top: 0;
}
table.detail-view th {
text-align: right;
}
table.detail-view th:after {
content: ' :';
}
.icon-cell {
text-align: center;
}
.representative h1 {
text-align: center;
}
.representative p.photo {
text-align: center;
}
.representative tr.score th {
vertical-align: bottom;
}
.representative tr.score td {
font-size: 1.4em;
}
.representative tr.score td .label {
padding: 2px;
}
.positions form {
width: 50%;
margin: auto;
}
.vote_negative {
color: red;
}
.vote_positive {
color: green;
}
.vote_abstain {
color: #333;
}
.representative_grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.representative_grid .representative_item {
width: 300px;
margin: 2px;
padding: 10px;
background: #f5f5f5;
}
.representative_grid .representative_item .photo {
float: left;
}
.representative_grid .representative_item .name {
font-weight: bold;
}
.representative_grid .representative_item ul {
list-style-type: none;
text-indent: 10px;
}
.quote {
width: 70%;
margin: auto;
}
.quote-header {
font-style: italic;
}
.long-quote p:first-child:before {
content: '« ';
font-style: italic;
font-size: 1em;
}
.long-quote p:last-child:after {
content: ' »';
font-style: italic;
font-size: 1em;
text-align: right;
}
body {
background: #E5E5E5;
}
.container,
.container-fluid {
background: white;
}
.main-container {
padding-top: 15px;
}
.label a {
color: white;
}
.label {
margin: 0 1px;
}
This diff is collapsed.
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