New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

generator-politico-django

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-politico-django

Yeoman generator for building static assets inside django apps at Politico.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-72.73%
Maintainers
1
Weekly downloads
 
Created
Source

Politico

generator-politico-django npm version

A Yeoman generator to scaffold a static assets development environment inside a Django app.

What it does:

  • Scaffolds your development directory.
  • Compiles SCSS and bundles JS written in modular ES2015 using browserify to the standard static directory for your Django app.

What you'll need installed

Make sure you have node installed as well as the yarn package manager.

Then install gulp, yeoman and this generator, globally*:

$ npm install -g gulp-cli yo generator-politico-django

* You may need to prefix with sudo

How to use

Inside your Django app, create a fresh directory called staticapp at the root of your app and move into it:

$ mkdir staticapp
$ cd staticapp

Now run the generator and answer the questions it asks to build your dev environment.

$ yo politico-django

After the generator is finished, run gulp to start the development server.

$ gulp

Develop files in the src directory and they will be automatically compiled to the static directory of your app, assuming a structure like this:

  • <app_name>/static/<app_name>/js/
  • <app_name>/static/<app_name>/css/

Then you can simply use the standard static template tag to include your built assets in your Django templates:

{%load staticfiles%}
<link href="{%static '<app_name>/css/styles.css'%}" rel="stylesheet">
Javascript module naming convention

Browserify will watch for javascript files prefixed with main-*.js to bundle into modules. It will ignore all other files in the staticapp/src/js directory, but of course you can include those files in your main- scripts.

For example:

// my-sub-modules.js
modules.exports = () => {
    console.log('Hello world.');
}
// main-my-module.js
import myThing from 'my-sub-module.js';

myThing();

This helps you write more modular code.

Developing

To develop, clone this repository and use npm link to test changes locally before publishing updates.

Keywords

FAQs

Package last updated on 17 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc