Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build system refactor + ES6 refactor + upgrade dependancies #122

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
build
static
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
package-lock.json
node_modules
dist

*.egg-info
*.pyc
*.pyo
*~
.*
!.git*
!.babelrc
!.eslintrc
!.nvmrc
/*env
docs/_build
*.ipynb
Expand Down
48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,53 @@ Running Votr

sudo apt install virtualenv

2. Install node.js and npm. (Some Linux distributions bundle them together in
one package.) Check the version: npm 1 and 2 are too old. npm 3 and 4 are
probably OK. npm 5+ is ideal, but most Linux distributions don't have it yet
(including current Ubuntu and Debian). In that case, you can either:

* Install npm 3 despite its age and hope for the best. E.g. on Ubuntu:
`sudo apt install nodejs-legacy npm`.
* Use the unofficial up to date repositories from
https://nodejs.org/en/download/package-manager/, and install `nodejs`
(not `nodejs-legacy` and `npm`).

3. Create a virtualenv directory. A virtualenv is an isolated environment that
2. Create a virtualenv directory. A virtualenv is an isolated environment that
contains Python libraries, so that you don't have to install them
system-wide, and each project can use different versions without conflicts.

virtualenv -p python3 venv

4. Activate the virtualenv. (Basically, this just adds `venv/bin` to your
3. Activate the virtualenv. (Basically, this just adds `venv/bin` to your
current shell's `$PATH`. Instead, you could just use `venv/bin/python`
instead of `python`, `venv/bin/pip` instead of `pip`, etc.)

source venv/bin/activate

5. Install the latest version of `pip` (earlier versions don't support wheels),
4. Install the latest version of `pip` (earlier versions don't support wheels),
and then use it to install Python dependencies.

pip install -U pip
pip install -r requirements.txt

6. Start Votr. Remember to activate the virtualenv first if you haven't done it
5. Gather/build your CSS files:

# copy pre-built CSS files to votrfront/static/
./votrfront/buildcss.sh setup
# build the custom CSS
./votrfront/buildcss.sh
# build the bootstrap custom base CSS - not needed in 99.99% cases
./votrfront/buildcss.sh bootstrap

6. Install Node.js and npm/yarn. You can do so via
[NVM](https://github.com/creationix/nvm). Follow instructions on the NVM
website. After installing NVM, you may need to restart your
terminal / source .bashrc . Afterwards, run:

cd votrfront/js/
nvm use
npm i -g yarn
yarn
cd ../..

7. Start the Javascript bundler (you will need to have this open in another
terminal):

cd votrfront/js
yarn dev
# for production build, do
yarn build

8. Start Votr. Remember to activate the virtualenv first if you haven't done it
yet in this terminal.

./console.py serve --debug
Expand All @@ -79,6 +96,7 @@ Some documentation is on the wiki: https://github.com/fmfi-svt/votr/wiki
Some documentation is in docstrings in the source code and rendered with Sphinx:
http://svt.fmph.uniba.sk/~tomi/votrdoc/


Building documentation:

pip install sphinx sphinx-rtd-theme
Expand Down
53 changes: 53 additions & 0 deletions votrfront/buildcss.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

set -e

if [ "${1:0:6}" == "--env=" ]; then
source "${1:6}/bin/activate"
shift
fi

cd "$(dirname "$0")"

! [ -w "$HOME" ] && echo "HOME is not writable" && exit 1

mkdir -p static

if [ "$1" == "build" ] || [ "$1" == "" ]; then

sassc -s compressed css/src/main.scss css/dist/votr.css
cp css/dist/votr.css static/votr.css

elif [ "$1" == "bootstrap" ]; then

if ! [ -d node_modules/bootstrap-sass ]; then
npm install bootstrap-sass@^3.3
fi
bs=node_modules/bootstrap-sass/assets

sed -i "
# Don't use pointer cursor on buttons.
# http://lists.w3.org/Archives/Public/public-css-testsuite/2010Jul/0024.html
s@cursor: pointer; // 3@@
# Don't inherit color and font on inputs and selects.
s@color: inherit; // 1@@
s@font: inherit; // 2@@
" $bs/stylesheets/bootstrap/_normalize.scss

compressed='-s compressed'
sassc $compressed -I $bs/stylesheets css/src/_votr-bootstrap.scss css/dist/bootstrap.custom.css
cp css/dist/bootstrap.custom.css static/bootstrap.custom.css

elif [ "$1" == "setup" ]; then

cp css/dist/bootstrap.custom.css static/bootstrap.custom.css
cp css/dist/votr.css static/votr.css

elif [ "$1" == "clean" ]; then

rm -rf node_modules static

else
echo "usage: $0 [--env=path/to/venv] [build|clean]"
exit 1
fi
101 changes: 0 additions & 101 deletions votrfront/buildstatic.sh

This file was deleted.

1 change: 1 addition & 0 deletions votrfront/css/dist/bootstrap.custom.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions votrfront/css/dist/votr.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions votrfront/css/src/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Mixins
// --------------------------------------------------

// Utilities
@import "mixins/hide-text";
@import "mixins/opacity";
@import "mixins/image";
@import "mixins/labels";
@import "mixins/reset-filter";
@import "mixins/resize";
@import "mixins/responsive-visibility";
@import "mixins/size";
@import "mixins/tab-focus";
@import "mixins/reset-text";
@import "mixins/text-emphasis";
@import "mixins/text-overflow";
@import "mixins/vendor-prefixes";

// Components
@import "mixins/alerts";
@import "mixins/buttons";
@import "mixins/panels";
@import "mixins/pagination";
@import "mixins/list-group";
@import "mixins/nav-divider";
@import "mixins/forms";
@import "mixins/progress-bar";
@import "mixins/table-row";

// Skins
@import "mixins/background-variant";
@import "mixins/border-radius";
@import "mixins/gradients";

// Layout
@import "mixins/clearfix";
@import "mixins/center-block";
@import "mixins/nav-vertical-align";
@import "mixins/grid-framework";
@import "mixins/grid";
1 change: 1 addition & 0 deletions votrfront/css/src/_spinner.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$spinner: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjx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