Migrated from bower to yarn and from ruby-sass to node-sass

This commit is contained in:
datalets 2019-08-09 15:17:25 +02:00
parent b79f651c4e
commit 8f2ac884a9
6 changed files with 5083 additions and 44 deletions

4
.gitignore vendored
View File

@ -8,6 +8,7 @@
/env/
/venv/
/static/
/assets/
/media/
/tmp/
/.keys/
@ -15,4 +16,5 @@
/Vagrantfile.local
/docs/_build/
/node_modules/
/publichealth/static/libs/
/publichealth/static/libs
publichealth.home.json

View File

@ -1,3 +1,5 @@
const sass = require('node-sass');
module.exports = function(grunt) {
grunt.initConfig({
@ -21,12 +23,11 @@ module.exports = function(grunt) {
}
},
// TODO: switch to https://github.com/sindresorhus/grunt-sass
sass: { // Task
dev: { // Target
options: { // Target options
style: 'expanded',
sourcemap: 'none'
implementation: sass,
sourcemap: false
},
files: { // Dictionary of files
"./assets/css/main.css": "publichealth/static/css/main.scss"
@ -34,8 +35,9 @@ module.exports = function(grunt) {
},
dist: {
options: {
style: 'compressed',
sourcemap: 'none'
outputStyle: 'compressed',
implementation: sass,
sourcemap: true
},
files: {
"./assets/css/main.min.css": "publichealth/static/css/main.scss"
@ -71,10 +73,10 @@ module.exports = function(grunt) {
});
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-bg-shell');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-sass');
grunt.registerTask('default', ['imagemin', 'sass']);
grunt.registerTask('browser-sync', [
'bgShell',

View File

@ -15,21 +15,16 @@ To set up a full development environment, follow all these instructions.
**Frontend setup**
If not using Vagrant, you will need to have Ruby and SASS installed on your system, e.g.:
```
sudo apt-get install ruby-sass
```
Make sure a recent version of node.js (we recommend using [nave.sh](https://gipublichealth/static/org/archive-message.htmlthub.com/isaacs/nave)), then:
```
npm install -g bower grunt-cli
npm install
bower install
npm install -g yarn grunt-cli
yarn install
```
The first command (`..install -g..`) may require `sudo` if you installed node.js as a system package.
The first command (`..install -g..`) may require `sudo` if you installed node.js as a system package. Afterwards, to compile the frontend, you should be able to run:
`grunt`
If you are only working on the frontend, you can start a local webserver and work on frontend assets without the backend setup described below. There is a `grunt browser-sync` setup for working with frontend assets.

View File

@ -1,22 +0,0 @@
{
"name": "public-health-ch",
"authors": [],
"description": "",
"main": [],
"license": "MIT",
"homepage": "http://public-health.ch/",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap-sass": "bootstrap-sass-official#^3.3.7",
"slick-carousel": "^1.4.1",
"slick-lightbox": "^0.2.10",
"cookieconsent": "cookieconsent2#^3.0.6"
}
}

View File

@ -1,21 +1,26 @@
{
"name": "public-health-ch",
"version": "1.0.0",
"description": "Public Health Schweiz",
"description": "THIS FILE IS NO LONGER USED: SEE README",
"directories": {
"doc": "docs"
},
"dependencies": {
"bower": "latest"
"@bower_components/bootstrap-sass": "twbs/bootstrap-sass#^3.3.7",
"@bower_components/cookieconsent": "silktide/cookieconsent2#^3.0.6",
"@bower_components/jquery": "jquery/jquery-dist#~1",
"@bower_components/slick-carousel": "kenwheeler/slick#~1.4.1",
"@bower_components/slick-lightbox": "mreq/slick-lightbox#^0.2.10"
},
"devDependencies": {
"grunt": "^1.0.2",
"grunt-bg-shell": "^2.3.3",
"grunt-bowercopy": "^1.2.4",
"grunt-browser-sync": "^2.2.0",
"grunt-contrib-imagemin": "^2.0.1",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-watch": "^1.1.0"
"grunt-contrib-watch": "^1.1.0",
"grunt-sass": "^3.0.2",
"node-sass": "^4.12.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
@ -26,5 +31,8 @@
},
"author": "Oleg Lavrovsky <oleg@datalets.ch>",
"license": "MIT",
"homepage": "https://github.com/datalets/public-health-ch#readme"
"homepage": "https://github.com/datalets/public-health-ch#readme",
"engines": {
"yarn": ">= 1.0.0"
}
}

5054
yarn.lock Normal file

File diff suppressed because it is too large Load Diff