mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-13 17:42:26 +03:00
parent
dbdedb81c1
commit
be1024cd06
|
@ -2,9 +2,9 @@
|
||||||
"project_name": "My Awesome Project",
|
"project_name": "My Awesome Project",
|
||||||
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}",
|
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}",
|
||||||
"description": "Behold My Awesome Project!",
|
"description": "Behold My Awesome Project!",
|
||||||
"author_name": "Daniel Roy Greenfeld",
|
"author_name": "{{ cookiecutter.project_slug }}",
|
||||||
"email": "{{ cookiecutter.author_name.lower()|replace(' ', '-') }}@example.com",
|
|
||||||
"domain_name": "example.com",
|
"domain_name": "example.com",
|
||||||
|
"email": "{{ cookiecutter.author_name.lower()|replace(' ', '-') }}@example.com",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"open_source_license": [
|
"open_source_license": [
|
||||||
"MIT",
|
"MIT",
|
||||||
|
@ -28,8 +28,7 @@
|
||||||
],
|
],
|
||||||
"js_task_runner": [
|
"js_task_runner": [
|
||||||
"None",
|
"None",
|
||||||
"Gulp",
|
"Gulp"
|
||||||
"Grunt"
|
|
||||||
],
|
],
|
||||||
"custom_bootstrap_compilation": "n",
|
"custom_bootstrap_compilation": "n",
|
||||||
"use_compressor": "n",
|
"use_compressor": "n",
|
||||||
|
|
|
@ -60,9 +60,8 @@ postgresql_version [1]
|
||||||
js_task_runner [1]
|
js_task_runner [1]
|
||||||
Select a JavaScript task runner. The choices are:
|
Select a JavaScript task runner. The choices are:
|
||||||
|
|
||||||
1. Gulp_
|
1. None
|
||||||
2. Grunt_
|
2. Gulp_
|
||||||
3. None
|
|
||||||
|
|
||||||
custom_bootstrap_compilation [n]
|
custom_bootstrap_compilation [n]
|
||||||
Indicates whether the project should support Bootstrap recompilation
|
Indicates whether the project should support Bootstrap recompilation
|
||||||
|
@ -114,7 +113,6 @@ debug [n]
|
||||||
.. _PostgreSQL: https://www.postgresql.org/docs/
|
.. _PostgreSQL: https://www.postgresql.org/docs/
|
||||||
|
|
||||||
.. _Gulp: https://github.com/gulpjs/gulp
|
.. _Gulp: https://github.com/gulpjs/gulp
|
||||||
.. _Grunt: https://github.com/gruntjs/grunt
|
|
||||||
|
|
||||||
.. _Django Compressor: https://github.com/django-compressor/django-compressor
|
.. _Django Compressor: https://github.com/django-compressor/django-compressor
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,6 @@ def remove_heroku_files():
|
||||||
os.remove(file_name)
|
os.remove(file_name)
|
||||||
|
|
||||||
|
|
||||||
def remove_grunt_files():
|
|
||||||
file_names = ["Gruntfile.js"]
|
|
||||||
for file_name in file_names:
|
|
||||||
os.remove(file_name)
|
|
||||||
|
|
||||||
|
|
||||||
def remove_gulp_files():
|
def remove_gulp_files():
|
||||||
file_names = ["gulpfile.js"]
|
file_names = ["gulpfile.js"]
|
||||||
for file_name in file_names:
|
for file_name in file_names:
|
||||||
|
@ -264,16 +258,11 @@ def main():
|
||||||
if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y":
|
if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y":
|
||||||
append_to_gitignore_file("!.envs/.local/")
|
append_to_gitignore_file("!.envs/.local/")
|
||||||
|
|
||||||
if "{{ cookiecutter.js_task_runner}}".lower() == "gulp":
|
if "{{ cookiecutter.js_task_runner}}".lower() == "none":
|
||||||
remove_grunt_files()
|
|
||||||
elif "{{ cookiecutter.js_task_runner}}".lower() == "grunt":
|
|
||||||
remove_gulp_files()
|
remove_gulp_files()
|
||||||
else:
|
|
||||||
remove_gulp_files()
|
|
||||||
remove_grunt_files()
|
|
||||||
remove_packagejson_file()
|
remove_packagejson_file()
|
||||||
if (
|
if (
|
||||||
"{{ cookiecutter.js_task_runner }}".lower() in ["grunt", "gulp"]
|
"{{ cookiecutter.js_task_runner }}".lower() != "none"
|
||||||
and "{{ cookiecutter.use_docker }}".lower() == "y"
|
and "{{ cookiecutter.use_docker }}".lower() == "y"
|
||||||
):
|
):
|
||||||
print(
|
print(
|
||||||
|
|
3
{{cookiecutter.project_slug}}/.gitignore
vendored
3
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -105,9 +105,6 @@ coverage
|
||||||
# nyc test coverage
|
# nyc test coverage
|
||||||
.nyc_output
|
.nyc_output
|
||||||
|
|
||||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# Bower dependency directory (https://bower.io/)
|
# Bower dependency directory (https://bower.io/)
|
||||||
bower_components
|
bower_components
|
||||||
|
|
||||||
|
|
|
@ -1,144 +0,0 @@
|
||||||
module.exports = function (grunt) {
|
|
||||||
|
|
||||||
var appConfig = grunt.file.readJSON('package.json');
|
|
||||||
|
|
||||||
// Load grunt tasks automatically
|
|
||||||
// see: https://github.com/sindresorhus/load-grunt-tasks
|
|
||||||
require('load-grunt-tasks')(grunt);
|
|
||||||
|
|
||||||
// Time how long tasks take. Can help when optimizing build times
|
|
||||||
// see: https://npmjs.org/package/time-grunt
|
|
||||||
require('time-grunt')(grunt);
|
|
||||||
|
|
||||||
var pathsConfig = function (appName) {
|
|
||||||
this.app = appName || appConfig.name;
|
|
||||||
|
|
||||||
return {
|
|
||||||
app: this.app,
|
|
||||||
templates: this.app + '/templates',
|
|
||||||
css: this.app + '/static/css',
|
|
||||||
sass: this.app + '/static/sass',
|
|
||||||
fonts: this.app + '/static/fonts',
|
|
||||||
images: this.app + '/static/images',
|
|
||||||
js: this.app + '/static/js',
|
|
||||||
manageScript: 'manage.py',
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
grunt.initConfig({
|
|
||||||
|
|
||||||
paths: pathsConfig(),
|
|
||||||
pkg: appConfig,
|
|
||||||
|
|
||||||
// see: https://github.com/gruntjs/grunt-contrib-watch
|
|
||||||
watch: {
|
|
||||||
gruntfile: {
|
|
||||||
files: ['Gruntfile.js']
|
|
||||||
},
|
|
||||||
sass: {
|
|
||||||
files: ['<%= paths.sass %>/**/*.{scss,sass}'],
|
|
||||||
tasks: ['sass:dev'],
|
|
||||||
options: {
|
|
||||||
atBegin: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
livereload: {
|
|
||||||
files: [
|
|
||||||
'<%= paths.js %>/**/*.js',
|
|
||||||
'<%= paths.sass %>/**/*.{scss,sass}',
|
|
||||||
'<%= paths.app %>/**/*.html'
|
|
||||||
],
|
|
||||||
options: {
|
|
||||||
spawn: false,
|
|
||||||
livereload: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// see: https://github.com/sindresorhus/grunt-sass
|
|
||||||
sass: {
|
|
||||||
dev: {
|
|
||||||
options: {
|
|
||||||
outputStyle: 'nested',
|
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
|
||||||
includePaths: ['node_modules/bootstrap/scss'],
|
|
||||||
{% endif %}
|
|
||||||
sourceMap: false,
|
|
||||||
precision: 10
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
'<%= paths.css %>/project.css': '<%= paths.sass %>/project.scss'
|
|
||||||
},
|
|
||||||
},
|
|
||||||
dist: {
|
|
||||||
options: {
|
|
||||||
outputStyle: 'compressed',
|
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
|
||||||
includePaths: ['node_modules/bootstrap/scss'],
|
|
||||||
{% endif %}
|
|
||||||
sourceMap: false,
|
|
||||||
precision: 10
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
'<%= paths.css %>/project.css': '<%= paths.sass %>/project.scss'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
//see https://github.com/nDmitry/grunt-postcss
|
|
||||||
postcss: {
|
|
||||||
options: {
|
|
||||||
map: true, // inline sourcemaps
|
|
||||||
|
|
||||||
processors: [
|
|
||||||
require('pixrem')(), // add fallbacks for rem units
|
|
||||||
require('autoprefixer')({browsers: [
|
|
||||||
'Android 2.3',
|
|
||||||
'Android >= 4',
|
|
||||||
'Chrome >= 20',
|
|
||||||
'Firefox >= 24',
|
|
||||||
'Explorer >= 8',
|
|
||||||
'iOS >= 6',
|
|
||||||
'Opera >= 12',
|
|
||||||
'Safari >= 6'
|
|
||||||
]}), // add vendor prefixes
|
|
||||||
require('cssnano')() // minify the result
|
|
||||||
]
|
|
||||||
},
|
|
||||||
dist: {
|
|
||||||
src: '<%= paths.css %>/*.css'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// see: https://npmjs.org/package/grunt-bg-shell
|
|
||||||
bgShell: {
|
|
||||||
_defaults: {
|
|
||||||
bg: true
|
|
||||||
},
|
|
||||||
runDjango: {
|
|
||||||
cmd: 'python <%= paths.manageScript %> runserver'
|
|
||||||
},
|
|
||||||
{% if cookiecutter.use_mailhog == "y" and cookiecutter.use_docker == 'n' -%}runMailHog: {
|
|
||||||
cmd: './mailhog'
|
|
||||||
},{%- endif %}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask('serve', [
|
|
||||||
{% if cookiecutter.use_mailhog == "y" and cookiecutter.use_docker == 'n' -%}
|
|
||||||
'bgShell:runMailHog',
|
|
||||||
{%- endif %}
|
|
||||||
'bgShell:runDjango',
|
|
||||||
'watch'
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask('build', [
|
|
||||||
'sass:dist',
|
|
||||||
'postcss'
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask('default', [
|
|
||||||
'build'
|
|
||||||
]);
|
|
||||||
|
|
||||||
};
|
|
|
@ -3,28 +3,7 @@
|
||||||
"version": "{{ cookiecutter.version }}",
|
"version": "{{ cookiecutter.version }}",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
{% if cookiecutter.js_task_runner == 'Grunt' %}
|
{% if cookiecutter.js_task_runner == 'Gulp' %}
|
||||||
"autoprefixer": "~8.1.0",
|
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
|
||||||
"bootstrap": "^4.0.0",
|
|
||||||
{% endif %}
|
|
||||||
"connect-livereload": "~0.6.0",
|
|
||||||
"cssnano": "~3.10.0",
|
|
||||||
"grunt": "~1.0.2",
|
|
||||||
"grunt-bg-shell": "~2.3.1",
|
|
||||||
"grunt-contrib-watch": "~1.0.0",
|
|
||||||
"grunt-postcss": "~0.9.0",
|
|
||||||
"grunt-sass": "~2.1.0",
|
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
|
||||||
"jquery": "^3.2.1-slim",
|
|
||||||
{% endif %}
|
|
||||||
"load-grunt-tasks": "~3.2.0",
|
|
||||||
"pixrem": "~4.0.1",
|
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
|
||||||
"popper.js": "^1.12.3",
|
|
||||||
{% endif %}
|
|
||||||
"time-grunt": "~1.2.1"
|
|
||||||
{% elif cookiecutter.js_task_runner == 'Gulp' %}
|
|
||||||
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
|
||||||
"bootstrap": "^4.0.0",
|
"bootstrap": "^4.0.0",
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -54,11 +33,8 @@
|
||||||
"node": ">=0.8.0"
|
"node": ">=0.8.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
{% if cookiecutter.js_task_runner == 'Grunt' %}
|
{% if cookiecutter.js_task_runner == 'Gulp' %}
|
||||||
"dev": "grunt serve"
|
|
||||||
{% elif cookiecutter.js_task_runner == 'Gulp' %}
|
|
||||||
"dev": "gulp"
|
"dev": "gulp"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user