Skip to content

Commit

Permalink
replaced compass, #1029
Browse files Browse the repository at this point in the history
  • Loading branch information
parsch committed Sep 15, 2023
1 parent 030eae4 commit 7478985
Show file tree
Hide file tree
Showing 103 changed files with 6,427 additions and 3,423 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ docs/_themes/
.flake8
dist/*
django_grappelli.egg-info/*
grappelli/compass/.sass-cache/
grappelli/static/tinymce_dev
fabfile.py
.sass-cache
Expand Down
124 changes: 75 additions & 49 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,93 +1,119 @@
module.exports = function(grunt) {
const unixTimestamp = Math.floor(Date.now() / 1000);

module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pkg: grunt.file.readJSON("package.json"),
concat: {
dist: {
src: ['grappelli/static/grappelli/js/grappelli.js', 'grappelli/static/grappelli/js/jquery*.js'],
dest: 'grappelli/static/grappelli/js/grappelli.min.js'
}
src: [
"grappelli/static/grappelli/js/grappelli.js",
"grappelli/static/grappelli/js/jquery*.js",
],
dest: "grappelli/static/grappelli/js/grappelli.min.js",
},
},
jshint: {
options: {
"expr": true,
"scripturl": true,
expr: true,
scripturl: true,
reporterOutput: "",
esversion: 6,
},
beforeconcat: ['grappelli/static/grappelli/js/grappelli.js', 'grappelli/static/grappelli/js/jquery*.js'],
afterconcat: ['grappelli/static/grappelli/js/grappelli.min.js']
beforeconcat: [
"grappelli/static/grappelli/js/grappelli.js",
"grappelli/static/grappelli/js/jquery*.js",
],
afterconcat: ["grappelli/static/grappelli/js/grappelli.min.js"],
},
uglify: {
build: {
files: {
'grappelli/static/grappelli/js/grappelli.min.js': ['grappelli/static/grappelli/js/grappelli.min.js']
}
}
"grappelli/static/grappelli/js/grappelli.min.js": [
"grappelli/static/grappelli/js/grappelli.min.js",
],
},
},
},
compass: {
dist: {
options: {
config: 'grappelli/compass/config.rb',
sassDir: 'grappelli/compass/sass',
cssDir: 'grappelli/static/grappelli/stylesheets',
imagesDir: 'grappelli/static/grappelli/images',
javascriptsDir: 'grappelli/static/grappelli/javascripts',
outputStyle: 'compressed',
relativeAssets: true,
noLineComments: true
}
}
sprite: {
all: {
algorithm: "top-down",
src: "grappelli/static/grappelli/images/icons/*.png",
dest: `grappelli/static/grappelli/images/spritesheet-${unixTimestamp}.png`,
destCss: "grappelli/sass/partials/library/_spritesheet.scss",
imgPath: `../images/spritesheet-${unixTimestamp}.png`,
padding: 200,
},
},
exec: {
build_sphinx: {
cmd: 'sphinx-build -b html docs docs/_build'
}
cmd: "sphinx-build -b html docs docs/_build",
},
sass: {
cmd: "npm run sass",
},
},
flake8: {
options: {
maxLineLength: 200,
format: 'pylint',
format: "pylint",
showSource: true,
ignore: ['E501']
ignore: ["E501"],
},
src: ['setup.py', 'grappelli/**/*.py'],
src: ["setup.py", "grappelli/**/*.py"],
},
watch: {
js: {
files: ['grappelli/static/grappelli/js/grappelli.js', 'grappelli/static/grappelli/js/jquery*.js'],
tasks: ['jshint:beforeconcat', 'concat', 'jshint:afterconcat', 'uglify']
files: [
"grappelli/static/grappelli/js/grappelli.js",
"grappelli/static/grappelli/js/jquery*.js",
],
tasks: [
"jshint:beforeconcat",
"concat",
"jshint:afterconcat",
"uglify",
],
},
css: {
files: ['grappelli/compass/sass/**/*.scss'],
tasks: ['compass']
files: ["grappelli/sass/**/*.scss"],
tasks: ["exec:sass"],
},
sprite: {
files: ["grappelli/static/grappelli/images/icons/*.png"],
tasks: ["sprite:all"],
},
sphinx: {
files: ['docs/*.rst', 'docs/*.py'],
tasks: ['exec:build_sphinx']
files: ["docs/*.rst", "docs/*.py"],
tasks: ["exec:build_sphinx"],
},
},
});

// Load
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-flake8');
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify-es");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-compass");
grunt.loadNpmTasks("grunt-exec");
grunt.loadNpmTasks("grunt-flake8");
grunt.loadNpmTasks("grunt-spritesmith");

// Javascripts
grunt.registerTask('javascripts', 'JSHint, Concat and Uglify.', function() {
grunt.task.run(['jshint:beforeconcat', 'concat', 'jshint:afterconcat', 'uglify']);
grunt.registerTask("javascripts", "JSHint, Concat and Uglify.", function () {
grunt.task.run([
"jshint:beforeconcat",
"concat",
"jshint:afterconcat",
"uglify",
]);
});

// Sphinx
grunt.registerTask('sphinx', 'Build doc files.', function() {
grunt.task.run(['exec:build_sphinx']);
grunt.registerTask("sphinx", "Build doc files.", function () {
grunt.task.run(["exec:build_sphinx"]);
});

// Default
grunt.registerTask('default', ['watch']);

grunt.registerTask("default", ["watch"]);
};
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

# General information about the project.
project = u'Django Grappelli'
copyright = u'2022, Patrick Kranzlmueller'
copyright = u'2023, Patrick Kranzlmueller'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
22 changes: 13 additions & 9 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@ To file an issue with Grapelli, see `contributing <https://github.com/sehmaschin
Requirements
------------

For working with Javascript and CSS, you need `Node <http://nodejs.org>`_, `Ruby <https://www.ruby-lang.org>`_, `Grunt <http://gruntjs.com>`_, `Sass <http://sass-lang.com>`_ and `Compass <http://compass-style.org>`_. In order to update the documentation, `Sphinx <http://sphinx-doc.org>`_ and the `Sphinx RTD Theme <https://github.com/snide/sphinx_rtd_theme>`_ have to be installed. Finally, you should install `flake8 <https://flake8.readthedocs.org>`_ when working with python files.
For working with Javascript and CSS, you need `Node <http://nodejs.org>`_, `Grunt <http://gruntjs.com>`_ and `Sass <http://sass-lang.com>`_. In order to update the documentation, `Sphinx <http://sphinx-doc.org>`_ and the `Sphinx RTD Theme <https://github.com/snide/sphinx_rtd_theme>`_ have to be installed. Finally, you should install `flake8 <https://flake8.readthedocs.org>`_ when working with python files.

It's out of the scope of this tutorial to go into details, but you should find lots of useful references on how to install these dependencies.

Node is needed for Grunt, Ruby for Sass/Compass::
Node is needed for Grunt and Sass::

brew install node
brew install ruby

Now you are able to install Grunt and Compass (Sass is automatically installed with Compass)::
Now you are able to install Grunt::

npm install -g grunt-cli
gem install compass

Change to the root of your grappelli installation, where ``package.json`` and ``Gruntfile.js`` are located and install the Grunt dependencies::
Change to the root of your grappelli installation, where ``package.json`` and ``Gruntfile.js`` are located and install the dependencies (some Grunt dependencies are outdated and can't be updated, that's why you need "--force")::

npm install
npm install --force

Start your virtual environment and install the python dependencies::

Expand Down Expand Up @@ -74,11 +72,17 @@ If you change any of the |grappelli| javascripts, you need to jshint the files a
grunt javascripts
When working with CSS (which is .scss in our case), you have to compile with:
When working with CSS (which is .scss in our case), you have to watch and compile with:

.. code-block:: python
grunt compass
npm run sass
or

.. code-block:: python
grunt exec:sass
.. _contributingdocs:

Expand Down
12 changes: 1 addition & 11 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,13 @@ see :ref:`Troubleshooting <troubleshooting>`.
Which Browser do I need with Grappelli?
---------------------------------------

We are testing with Firefox, Chrome and Safari. IE and Opera should work fine as well.
We are testing with Firefox, Chrome and Safari. Brave, Edge, Opera, Vivaldi and other modern browsers should work fine as well.

Can I use another editor than TinyMCE?
--------------------------------------

Of course (better use markdown anyway).

Why don't you use Twitter Bootstrap?
------------------------------------

For now, custom Compass-based stylesheets gives us much more options. But we do understand the need to easily customize the admin interface and we're discussing this issue on a regular basis.

Do you guys cooperate with the Django–Devs?
-------------------------------------------

Occasionally, we have been discussing features and implementations in the past.

How can I contribute?
---------------------

Expand Down
24 changes: 0 additions & 24 deletions grappelli/compass/config.rb

This file was deleted.

Loading

0 comments on commit 7478985

Please sign in to comment.