mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-25 19:14:03 +03:00
4b06fe3958
* Introduce static asset build infrastructure * Enhance gulpfile.js * Introduce node service * BrowserSync debug-only support * Remove newline before BrowserSync debug-only support section * FIx node Dockerfile package.json COPY * Try fiixing node Dockerfile package.json COPY ones again * Switch to `node:7-slim` * Try switching to node:6 To account for possible node:7 docker-compose incompatibiltiy * Revert "Try switching to node:6" This reverts commit62cc02df1a
. * Try switcging workdir to /app * Try utilizing relative package.json path * Resetting to the last version working locally with docker-compose 1.11.x * Build upon the latest node:7.9-slim * Stop dockerignoring package.json * Fix typo * Try a different package.json path * Revert "Try a different package.json path" This reverts commitf29f8500b8
. * Revert "Fix typo" This reverts commit02033729b5
. * Revert "Stop dockerignoring package.json" This reverts commit63c5491546
. * Upgrade docker-engine and docker-compose used by Travis CI * Fix .travis.yml comments * Inline docker-engine and docker-compose versions * DEBUG: pwd * Revert "DEBUG: pwd " This reverts commit6c2ed4321a
. * Try copying package.json to the same dir as node Dockerfile's * Revert "Try copying package.json to the same dir as node Dockerfile's" This reverts commit24340a0783
. * Try out node:7.9 * Revert "Try out node:7.9" This reverts commit32286d33c2
. * Revert "Upgrade docker-engine and docker-compose used by Travis CI" * Get rid of npm-check-updates Reason: Reserved for the upcoming PR * Get rid of npm-check Reason: Reserved for the upcoming PR * Get rid of 'standard' npm package Reason: Reserved for the upcoming PR * Clean up package.json * Preserve package.json uncoditionally Since we now have *unconditional* node.js integration, `package.json` must be out there whenever `node` service gets built * Upgrade node service image to 7.10 * Document Node.js-Docker integration * Fix gulpfile.js images region name * Get rid of Gulp migrate task * Document Gulp-Docker integration * Introduce static asset build infrastructure * Enhance gulpfile.js * Introduce node service * BrowserSync debug-only support * Remove newline before BrowserSync debug-only support section * FIx node Dockerfile package.json COPY * Try fiixing node Dockerfile package.json COPY ones again * Switch to `node:7-slim` * Try switching to node:6 To account for possible node:7 docker-compose incompatibiltiy * Revert "Try switching to node:6" This reverts commit62cc02df1a
. * Try switcging workdir to /app * Try utilizing relative package.json path * Resetting to the last version working locally with docker-compose 1.11.x * Build upon the latest node:7.9-slim * Stop dockerignoring package.json * Revert "Stop dockerignoring package.json" This reverts commit63c5491546
. * Fix typo * Revert "Fix typo" This reverts commit02033729b5
. * Try a different package.json path * Revert "Try a different package.json path" This reverts commitf29f8500b8
. * Upgrade docker-engine and docker-compose used by Travis CI * Fix .travis.yml comments * Inline docker-engine and docker-compose versions * DEBUG: pwd * Revert "DEBUG: pwd " This reverts commit6c2ed4321a
. * Try copying package.json to the same dir as node Dockerfile's * Revert "Try copying package.json to the same dir as node Dockerfile's" This reverts commit24340a0783
. * Try out node:7.9 * Revert "Try out node:7.9" This reverts commit32286d33c2
. * Revert "Upgrade docker-engine and docker-compose used by Travis CI" * Get rid of npm-check-updates Reason: Reserved for the upcoming PR * Get rid of npm-check Reason: Reserved for the upcoming PR * Get rid of 'standard' npm package Reason: Reserved for the upcoming PR * Clean up package.json * Preserve package.json uncoditionally Since we now have *unconditional* node.js integration, `package.json` must be out there whenever `node` service gets built * Upgrade node service image to 7.10 * Document Node.js-Docker integration * Fix gulpfile.js images region name * Get rid of Gulp migrate task * Document Gulp-Docker integration * Remove Gulp-Docker integraton not supported initialization message
77 lines
2.6 KiB
ReStructuredText
77 lines
2.6 KiB
ReStructuredText
Gulp with Docker
|
|
================
|
|
|
|
.. index:: gulp, gulpjs, gulpfile, gulpfilejs, docker, docker-compose
|
|
|
|
`Gulp`_ support is provided out-of-the-box, ready for use as-is, or with any kind of customizations suiting the specific needs of the project.
|
|
|
|
.. _`Gulp`: http://gulpjs.com/
|
|
|
|
*All paths are relative to the generated project's root.*
|
|
|
|
|
|
Prerequisites
|
|
-------------
|
|
|
|
- These :ref:`nodewithdocker-prereq` are satisfied.
|
|
|
|
|
|
Overview
|
|
--------
|
|
|
|
:ref:`nodewithdocker-overview` Node.js integration details first to get the whole picture.
|
|
|
|
Essential aspects of Gulp integration are
|
|
|
|
- :code:`./gulpfile.js` with Gulp tasks defined;
|
|
- :code:`./{{ cookiecutter.project_slug }}/static/build/` (build directory) with static assets built via Gulp.
|
|
|
|
Let us take a closer look at :code:`./gulpfile.js`:
|
|
|
|
- paths to static assets are provided by :code:`pathsConfig()`;
|
|
- for clarity, related tasks are grouped by :code:`region`:
|
|
- :code:`images`:
|
|
- :code:`images`: run image-related tasks in parallel, namely:
|
|
- :code:`favicons-images`: process favicon images only;
|
|
- :code:`nonfavicons-images`: process all images except for favicons.
|
|
- :code:`scripts`:
|
|
- :code:`scripts`: run script-related tasks in sequence, namely:
|
|
- :code:`js-scripts`: process js scripts.
|
|
- :code:`styles`:
|
|
- :code:`styles`: run script-related tasks in sequence, namely:
|
|
- :code:`sass-styles`: process SCSS styles;
|
|
- :code:`css-styles`: process CSS styles.
|
|
- :code:`build`:
|
|
- :code:`build`: run :code:`images`, :code:`scripts`, and :code:`styles` in parallel;
|
|
- :code:`clean-build`: clean up build directory:
|
|
- the :code:`default` task runs the following ones in sequence:
|
|
- :code:`build`;
|
|
- :code:`init-browserSync`: initialize `BrowserSync`_;
|
|
- :code:`watch`: watch static asset files/directories changes, running BrowserSync on any changes.
|
|
|
|
.. _`BrowserSync`: https://www.browsersync.io/
|
|
|
|
|
|
Workflow
|
|
--------
|
|
|
|
#. [*skip if done*] :ref:`devlocdocker-build-the-stack`;
|
|
#. :ref:`devlocdocker-boot-the-system`.
|
|
|
|
By default, :code:`gulp` command gets executed immediately after :code:`node`
|
|
container startup (see :code:`./dev.yml` for details) which in turn invokes
|
|
the :code:`default` task, so generally one would not need to run any
|
|
of the aforementioned tasks manually. However, should the need arise,
|
|
oftentimes just a few of the tasks listed above will be used to, for instance,
|
|
straightforwardly :code:`build` all assets
|
|
|
|
.. code-block:: bash
|
|
|
|
$ docker-compose -f dev.yml exec node gulp build
|
|
|
|
or build :code:`scripts` selectively
|
|
|
|
.. code-block:: bash
|
|
|
|
$ docker-compose -f dev.yml exec node gulp scripts
|