Personally I use a mixture of Vagrant, Docker, Gulp and makefiles to automate the entire process.
You run the gulp process as a backgrounded job, and then the django runserver in the foreground.. of course, this means gulp is then not interactive.. if you want both to be inter, then you have to use two separate shells, or you can use a tmux script to make it pretty. You could either keep your static files inside the static dir then build to a sub dir, then upon release you would remove all but the subdir, but this is of course a bit hacky. You can instead keep the static files out of the static dir, and only build out to that dir instead. You do not want to be committing compiled js/css, so you should automate this entire process as part of your CI deployment. You can use something like CircleCI and Docker Hub to automate this. Pro tip - don't attempt to make all this work automagically with django-pipeline or other tools, it will end in tears. I literally spent over a month prototyping many different workflows, and I'm still not 100% happy with the end outcome. Remember that this can quickly turn into a rabbit hole, and also remember that both Gulp and Grunt have *serious* performance issues with larger file counts (100% cpu when using default settings). I haven't found a single article that has a workflow which has done it "correctly", and even my own has problems... if you have a week of time to sink, then prototype your heart out... otherwise, just do whatever gets the job done. As for linking to the concat/minified versions, you'd just use settings.DEBUG in your template and link to .min.css if DEBUG is true, there's no need to use HTML libraries, I'm not sure what your reasoning behind that was. Remember that depending on your level of minification, it might break your source or cause weirdness, so you should always run tests against your minified version as part of your CI build. Another thing to remember, both Gulp/Grunt do not gracefully handle parser errors by default, so you could end up with your build process exiting but the run server still going. I have seen some people that spawn a process from runserver, but this is particularly nasty imho. I'm actually due to be doing a video about the way that we do it here, but it's unlikely to be released for another month. Hope this helps Cal PS) You should consider using your real name, or at least an alias, for friendly/public mailing lists like this one. This isn't full-disclosure :) On Thu, Nov 13, 2014 at 9:29 AM, Some Developer <someukdevelo...@gmail.com> wrote: > I'm using Gulp.js to deal with my JavaScript and SASS files to concatenate > them and minify them but I'm unsure how to merge it with my Django > workflow. I want to be able to automatically minify the files into one big > JavaScript and CSS file to reduce HTTP requests and to allow easy uploading > to a CDN but I need to be able to edit to my base template so that the > development version (which links to the files individually) can change to > linking to the big concatenated files. I was thinking about writing a > simple parser that does the changes automatically but am unsure what the > best method to use is. > > Should I use a Python HTML library to edit the HTML file or should I use > regular expressions to do the simple text replacement? I should be able to > call the Python script from a Gulp task to do the actual editing. I'd also > want to change the values back when I move back to the development version > of my site. > > Any help is appreciated. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/546479DD.6010407%40googlemail.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHKQagGzwL%2BSA8TZyScRrcF8V1v9qn9ta1aW4Od%3DOsXP-U%3DiaQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.