mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-13 16:34:52 +03:00
Add StimulusJS integration.
This commit is contained in:
parent
bb6320efc8
commit
6c05417b90
|
@ -121,6 +121,7 @@ Listed in alphabetical order.
|
||||||
Jan Van Bruggen `@jvanbrug`_
|
Jan Van Bruggen `@jvanbrug`_
|
||||||
Jelmer Draaijer `@foarsitter`_
|
Jelmer Draaijer `@foarsitter`_
|
||||||
Jens Nilsson `@phiberjenz`_
|
Jens Nilsson `@phiberjenz`_
|
||||||
|
Jerome Caisip `@jeromecaisip`_
|
||||||
Jerome Leclanche `@jleclanche`_ @Adys
|
Jerome Leclanche `@jleclanche`_ @Adys
|
||||||
Jimmy Gitonga `@afrowave`_ @afrowave
|
Jimmy Gitonga `@afrowave`_ @afrowave
|
||||||
John Cass `@jcass77`_ @cass_john
|
John Cass `@jcass77`_ @cass_john
|
||||||
|
@ -276,6 +277,7 @@ Listed in alphabetical order.
|
||||||
.. _@jangeador: https://github.com/jangeador
|
.. _@jangeador: https://github.com/jangeador
|
||||||
.. _@jazztpt: https://github.com/jazztpt
|
.. _@jazztpt: https://github.com/jazztpt
|
||||||
.. _@jcass77: https://github.com/jcass77
|
.. _@jcass77: https://github.com/jcass77
|
||||||
|
.. _@jeromecaisip: https://github.com/jeromecaisip
|
||||||
.. _@jleclanche: https://github.com/jleclanche
|
.. _@jleclanche: https://github.com/jleclanche
|
||||||
.. _@juliocc: https://github.com/juliocc
|
.. _@juliocc: https://github.com/juliocc
|
||||||
.. _@jvanbrug: https://github.com/jvanbrug
|
.. _@jvanbrug: https://github.com/jvanbrug
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
],
|
],
|
||||||
"custom_bootstrap_compilation": "n",
|
"custom_bootstrap_compilation": "n",
|
||||||
"use_compressor": "n",
|
"use_compressor": "n",
|
||||||
|
"use_stimulusJS": "n",
|
||||||
"use_celery": "n",
|
"use_celery": "n",
|
||||||
"use_mailhog": "n",
|
"use_mailhog": "n",
|
||||||
"use_sentry": "n",
|
"use_sentry": "n",
|
||||||
|
|
|
@ -78,6 +78,9 @@ custom_bootstrap_compilation:
|
||||||
use_compressor:
|
use_compressor:
|
||||||
Indicates whether the project should be configured to use `Django Compressor`_.
|
Indicates whether the project should be configured to use `Django Compressor`_.
|
||||||
|
|
||||||
|
use_stimulusJS:
|
||||||
|
Indicates whether the project should be configured to use `Stimulus JS`_.
|
||||||
|
|
||||||
use_celery:
|
use_celery:
|
||||||
Indicates whether the project should be configured to use Celery_.
|
Indicates whether the project should be configured to use Celery_.
|
||||||
|
|
||||||
|
@ -138,3 +141,6 @@ debug:
|
||||||
.. _Heroku: https://github.com/heroku/heroku-buildpack-python
|
.. _Heroku: https://github.com/heroku/heroku-buildpack-python
|
||||||
|
|
||||||
.. _Travis CI: https://travis-ci.org/
|
.. _Travis CI: https://travis-ci.org/
|
||||||
|
|
||||||
|
.. _Stimulus JS: https://stimulusjs.org/
|
||||||
|
|
||||||
|
|
|
@ -279,6 +279,10 @@ def remove_node_dockerfile():
|
||||||
shutil.rmtree(os.path.join("compose", "local", "node"))
|
shutil.rmtree(os.path.join("compose", "local", "node"))
|
||||||
|
|
||||||
|
|
||||||
|
def remove_stimulus_js_files():
|
||||||
|
shutil.rmtree(os.path.join("{{cookiecutter.project_slug}}", "static", "{{cookiecutter.project_slug}}"))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
debug = "{{ cookiecutter.debug }}".lower() == "y"
|
debug = "{{ cookiecutter.debug }}".lower() == "y"
|
||||||
|
|
||||||
|
@ -342,6 +346,9 @@ def main():
|
||||||
if "{{ cookiecutter.use_travisci }}".lower() == "n":
|
if "{{ cookiecutter.use_travisci }}".lower() == "n":
|
||||||
remove_dottravisyml_file()
|
remove_dottravisyml_file()
|
||||||
|
|
||||||
|
if "{{ cookiecutter.use_stimulusJS }}".lower() == "n":
|
||||||
|
remove_stimulus_js_files()
|
||||||
|
|
||||||
print(SUCCESS + "Project initialized, keep up the good work!" + TERMINATOR)
|
print(SUCCESS + "Project initialized, keep up the good work!" + TERMINATOR)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"name": "static",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "webpack --watch --config webpack.config.dev.js",
|
||||||
|
"build": "webpack --config webpack.config.prod.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.4.5",
|
||||||
|
"@babel/preset-env": "^7.4.5",
|
||||||
|
"axios": "^0.19.0",
|
||||||
|
"babel-loader": "^8.0.6",
|
||||||
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||||
|
"stimulus": "^1.1.1",
|
||||||
|
"webpack": "^4.34.0",
|
||||||
|
"webpack-cli": "^3.3.4"
|
||||||
|
},
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import {Controller} from "stimulus"
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import {Application} from "stimulus"
|
||||||
|
import {definitionsFromContext} from "stimulus/webpack-helpers"
|
||||||
|
|
||||||
|
const application = Application.start();
|
||||||
|
const context = require.context("./controllers", true, /\.js$/);
|
||||||
|
application.load(definitionsFromContext(context));
|
|
@ -0,0 +1,51 @@
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: {
|
||||||
|
'home': './src/pages/home/index.js',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.resolve(__dirname, 'dist'),
|
||||||
|
publicPath: 'static/'
|
||||||
|
},
|
||||||
|
mode: 'development',
|
||||||
|
optimization: {
|
||||||
|
splitChunks: {
|
||||||
|
minSize: 0,
|
||||||
|
cacheGroups: {
|
||||||
|
commons: {
|
||||||
|
name: 'commons',
|
||||||
|
chunks: 'all',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(png|jpg)$/,
|
||||||
|
use: [
|
||||||
|
'file-loader'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: [
|
||||||
|
'css-loader',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: {
|
||||||
|
loader: "babel-loader",
|
||||||
|
options: {
|
||||||
|
presets: ['@babel/env'],
|
||||||
|
plugins: ['transform-class-properties']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,5 @@
|
||||||
|
const path = require('path');
|
||||||
|
const dev_exports = require('./webpack.config.dev');
|
||||||
|
|
||||||
|
dev_exports['mode'] = 'production';
|
||||||
|
module.exports = dev_exports;
|
Loading…
Reference in New Issue
Block a user