8000 Organize the JS and less files by component. by ellisonbg · Pull Request #3325 · ipython/ipython · GitHub
[go: up one dir, main page]

Skip to content

Organize the JS and less files by component. #3325

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

Merged
merged 45 commits into from
May 24, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2862247
Reorg of the js/less/css files.
ellisonbg May 15, 2013
2bca338
More renaming of less files.
ellisonbg May 15, 2013
4097972
Renaming.
ellisonbg May 15, 2013
de4c504
Working on cleaning up our less files.
ellisonbg May 15, 2013
b0e170f
Moving files inside js folder.
ellisonbg May 15, 2013
da9b03d
Moving js files into subdirs.
ellisonbg May 15, 2013
a39ff10
More movign around of things in notebook and js/less.
ellisonbg May 15, 2013
8ca495d
Changes to templates.
ellisonbg May 15, 2013
b31ccdc
Moving js/less/css dirs up one level. Too much nesting.
ellisonbg May 15, 2013
e8d547d
More work on the less setup.
ellisonbg May 15, 2013
cb50a0a
Cleaning up less/css.
ellisonbg May 15, 2013
254c7b9
Wrok on static/tree
ellisonbg May 15, 2013
703d5c3
Adding link to new location of favicon.ico.
ellisonbg May 15, 2013
2e4d403
Putting custom.css/custom.js in static/user.
ellisonbg May 15, 2013
72e8441
Renaming main JS files.
ellisonbg May 16, 2013
a751c25
Fixing fabfile to compile all of the page's style.less.
ellisonbg May 16, 2013
6cb67bb
Adding files that I mised in the last commit.
ellisonbg May 16, 2013
7b3ad88
Going back to a single style.less and style.min.css.
ellisonbg May 16, 2013
75145ac
Fixing less variable names to use_the_right_convention.
ellisonbg May 16, 2013
6e2935f
Updating fabfile and templates for global style.min.css.
ellisonbg May 16, 2013
4780e5a
Finishing conversion of templates to use single style.*.
ellisonbg May 16, 2013
ea315a9
Adding style.less to each subdir - but still use global style.less
ellisonbg May 16, 2013
1ee7473
Moving static/user to static/custom to prevent future conflicts.
ellisonbg May 17, 2013
8952b60
Playing with the order of less imports.
ellisonbg May 17, 2013
3ef2c7a
Renaming notebooks->notebook on client side.
ellisonbg May 17, 2013
f9aea7a
Renaming notebooks->notebook in less and templates.
ellisonbg May 17, 2013
2b73e10
Creating override.css for each page.
ellisonbg May 21, 2013
4b20543
Fixing styles by overriding bootstrap.
ellisonbg May 21, 2013
79ff2f0
Updating notebook.less to use baseLineHeight from variables.
ellisonbg May 21, 2013
d418a01
Fixing pager style.çy
ellisonbg May 21, 2013
3c6a8ba
Fixing global less vars to use bootstrap.
ellisonbg May 21, 2013
e5932be
Turing style of tooltip.
ellisonbg May 22, 2013
13c1b51
Fixing monospace style vars.
ellisonbg May 22, 2013
9816572
Splitting notebook.less into separate files.
ellisonbg May 22, 2013
c21ea2a
Fixing image path in IPython.core.tests.
ellisonbg May 22, 2013
92e8082
Fixing CM3 line numbers for cells.
ellisonbg May 23, 2013
057141f
Creating services directory under static for kernels and friends.
ellisonbg May 23, 2013
ffc2cb9
Removing one level uf subdirs in static/custom.
ellisonbg May 24, 2013
66f74cb
Fixing code/pre styles in rendered HTML/
ellisonbg May 24, 2013
b0af278
Fixing path to custom.css in comment.
ellisonbg May 24, 2013
805e6e7
fix login page override css
minrk May 24, 2013
59692bf
only round CM-gutter corners on outer (left) edge
minrk May 24, 2013
8f0ea25
don't hardcode output_area pre background
minrk May 24, 2013
ccc6c8c
remove outline from heading-anchor links
minrk May 24, 2013
02876cc
Merge pull request #8 from minrk/jsreorg
ellisonbg May 24, 2013
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
2 changes: 1 addition & 1 deletion IPython/core/tests/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_image_filename_defaults():
embed=True)
nt.assert_raises(ValueError, display.Image)
nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True)
imgfile = os.path.join(tpath, 'frontend/html/notebook/static/ipynblogo.png')
imgfile = os.path.join(tpath, 'frontend/html/notebook/static/base/images/ipynblogo.png')
img = display.Image(filename=imgfile)
nt.assert_equal('png', img.format)
nt.assert_is_not_none(img._repr_png_())
Expand Down
50 changes: 47 additions & 3 deletions IPython/frontend/html/notebook/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# IPython Notebook development

# Development dependencies
## Development dependencies

Developers of the IPython Notebook will need to install the following tools:

Expand All @@ -9,7 +9,7 @@ Developers of the IPython Notebook will need to install the following tools:
* less (`npm install -g less`)
* bower (`npm install -g bower`)

# Components
## Components

We are moving to a model where our JavaScript dependencies are managed using
[bower](http://bower.io/). These packages are installed in `static/components`
Expand All @@ -22,8 +22,52 @@ we maintain our own fork of CodeMirror that is used with bower. This fork should
track the upstream CodeMirror exactly; the only difference is that we are adding
semantic versioned tags to our repo.

# less
## less

If you edit our `.less` files you will need to run the less compiler to build
our minified css files. This can be done by running `fab css` from this directory.

## JavaScript Documentation


How to Build/ view the doc for JavaScript. JavaScript documentation should follow a
style close to JSDoc one, so you should be able to build them with your favorite
documentation builder. Still the documentation comment are mainly written to be read
with YUI doc. You can either build a static version, or start a YUIdoc server that
will live update the doc at every page request.



To do so, you will need to install YUIdoc.

### Install NodeJS

Node is a browser less javascript interpreter. To install it please refer to
the documentation for your platform. Install also NPM (node package manager) if
it does not come bundled with it.

### Get YUIdoc

npm does by default install package in `./node_modules` instead of doing a
system wide install. I'll leave you to yuidoc docs if you want to make a system
wide install.

First, cd into js directory :
```bash
cd IPython/frontend/html/notebook/static/js/
# install yuidoc
npm install yuidocjs
```


### Run YUIdoc server

From IPython/frontend/html/notebook/static/js/
```bash
# run yuidoc for install dir
./node_modules/yuidocjs/lib/cli.js --server .
```

Follow the instruction and the documentation should be available on localhost:3000

Omitting `--server` will build a static version in the `out` folder by default.
23 changes: 16 additions & 7 deletions IPython/frontend/html/notebook/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,24 @@
static_dir = 'static'
components_dir = os.path.join(static_dir, 'components')


def css(minify=True):
def css(minify=True, verbose=False):
"""generate the css from less files"""
if minify not in ['True', 'False', True, False]:
abort('minify must be Boolean')
minify = (minify in ['True',True])
source = os.path.join('style', 'style.less')
target = os.path.join('style', 'style.min.css')
_compile_less(source, target, minify, verbose)

def _to_bool(b):
if not b in ['True', 'False', True, False]:
abort('boolean expected, got: %s' % b)
return (b in ['True', True])

min_flag= '-x' if minify is True else ''
def _compile_less(source, target, minify=True, verbose=False):
"""Complie a less file by source and target relative to static_dir"""
minify = _to_bool(minify)
verbose = _to_bool(verbose)
min_flag = '-x' if minify is True else ''
ver_flag = '--verbose' if verbose is True else ''
lessc = os.path.join('components', 'less.js', 'bin', 'lessc')
with lcd(static_dir):
local('{lessc} {min_flag} less/style.less css/style.min.css'.format(**locals()))
local('{lessc} {min_flag} {ver_flag} {source} {target}'.format(**locals()))

2 changes: 1 addition & 1 deletion IPython/frontend/html/notebook/notebook/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get(self, notebook_id):
nbm = self.notebook_manager
if not nbm.notebook_exists(notebook_id):
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
self.write(self.render_template('notebooks.html',
self.write(self.render_template('notebook.html',
project=self.project,
notebook_id=notebook_id,
kill_kernel=False,
Expand Down
8 changes: 8 additions & 0 deletions IPython/frontend/html/notebook/static/auth/css/override.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*This file contains any manual css for this page that needs to override the global styles.
This is only required when different pages style the same element differently. This is just
a hack to deal with our current css styles and no new styling should be added in this file.*/

#ipython-main-app {
margin: 50px auto;
text-align: center;
}
1 change: 1 addition & 0 deletions IPython/frontend/html/notebook/static/auth/less/login.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Custom styles for login.html
2 changes: 2 additions & 0 deletions IPython/frontend/html/notebook/static/auth/less/logout.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Custom styles for logout.html

2 changes: 2 additions & 0 deletions IPython/frontend/html/notebook/static/auth/less/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "../auth/less/login.less";
@import "../auth/less/logout.less";
11 changes: 11 additions & 0 deletions IPython/frontend/html/notebook/static/base/less/mixins.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Mixin CSS classes

.border-box-sizing {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}

.corner-all {
border-radius: @corner_radius;
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,3 @@ input.ui-button {
span#login_widget {
float: right;
}

.border-box-sizing {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}

4 changes: 4 additions & 0 deletions IPython/frontend/html/notebook/static/base/less/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import "../base/less/variables.less";
@import "../base/less/mixins.less";
@import "../base/less/flexbox.less";
@import "../base/less/page.less";
10 changes: 10 additions & 0 deletions IPython/frontend/html/notebook/static/base/less/variables.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Our customizations to bootstrap go here.

@textColor: @black;
@baseFontSize: 13px;
@baseLineHeight: 1.231;
@monoFontFamily: monospace; // to allow user to customize their fonts

// Our own global variables for all pages go here

@corner_radius: 4px;
6 changes: 0 additions & 6 deletions IPython/frontend/html/notebook/static/css/login.css

This file was deleted.

7 changes: 0 additions & 7 deletions IPython/frontend/html/notebook/static/css/logout.css

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Placeholder for custom user CSS

mainly to be overridden in profile/static/css/custom.css
mainly to be overridden in profile/static/custom/custom.css

This will always be an empty file in IPython
*/
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
*
*
* Placeholder for custom user javascript
* mainly to be overridden in profile/static/js/custom.js
* mainly to be overridden in profile/static/custom/custom.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you move it back, thoses sentences shoudl be fixed here and there.

* This will always be an empty file in IPython
*
* User could add any javascript in the `profile/static/js/custom.js` file
* User could add any javascript in the `profile/static/custom/custom.js` file
* (and should create it if it does not exist).
* It will be executed by the ipython notebook at load time.
*
* Same thing with `profile/static/css/custom.css` to inject custom css into the notebook.
* Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.
*
* Example :
*
Expand All @@ -34,10 +34,10 @@
* to load custom script into the notebook.
*
* // to load the metadata ui extension example.
* $.getScript('/static/js/celltoolbarpresets/example.js');
* $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
* // or
* // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
* $.getScript('/static/js/celltoolbarpresets/slideshow.js');
* $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
*
*
* @module IPython
Expand Down
48 changes: 0 additions & 48 deletions IPython/frontend/html/notebook/static/js/README.md

This file was deleted.

63 changes: 0 additions & 63 deletions IPython/frontend/html/notebook/static/less/bootstrap-custom.less

This file was deleted.

Loading
0