Giter Site home page Giter Site logo

django-node-assets's Introduction

linkedin facebook instagram vk

django-node-assets's People

Contributors

jensenbox avatar proofit404 avatar whitespy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-node-assets's Issues

Use "project-static" with NODE_MODULES_ROOT

Hi,

I'm trying to load my project static placed into a folder "project-static".

tree -L 3 project-static
project-static
└── tower_service_catalog
    ├── css
    │   ├── pygments.css
    │   └── tower_service_catalog.css
    ├── img
    │   ├── admin.png
    │   └── user.png
    └── js
        └── tower_service_catalog.js

Settings

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static/'),  # retrieve from collect static command
    os.path.join(BASE_DIR, "project-static/"),  # project statics
]
if not DEBUG:
    # useless during development, it's only required for deployment
    STATIC_ROOT = os.path.join(BASE_DIR, 'static')

# TO be set when prod
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

# https://github.com/whitespy/django-node-assets
STATICFILES_FINDERS = [
    'django_node_assets.finders.NodeModulesFinder',
]
NODE_PACKAGE_JSON = os.path.join(BASE_DIR, 'package.json')
NODE_MODULES_ROOT = os.path.join(BASE_DIR, 'node_modules')

Result
image

Wrong config?

Many thanks for your support !

When running `npminstall` arguments are ignored

I was trying to run the npminstall command to install my packages. Everytime I did the response was always the basic npm output when you just type "npm" and press enter. Nothing was installed.

npm <command>

Usage:

npm install        install all the dependencies in your project
npm install <foo>  add the <foo> dependency to your project
npm test           run this project's tests
npm run <foo>      run the script named <foo>
npm <command> -h   quick help on <command>
npm -l             display usage info for all commands
npm help <term>    search for help on <term>
npm help npm       more involved overview

I was intrigued by that so I checked the code from the command (the npminstall.py file) and did a little research at the documentation of the subprocess package, used to issue the npm install command.

I finally got the script working by removing the executable argument and moving its information to args, like so:

with Popen(
                    args=[
                        '{} install'.format(getattr(settings, 'NODE_PACKAGE_MANAGER_EXECUTABLE', '/usr/bin/npm')),
                        '--no-package-lock',
                        '--prefix={}'.format(node_package_context.package_dir)
                    ],
                    #executable=getattr(settings, 'NODE_PACKAGE_MANAGER_EXECUTABLE', '/usr/bin/npm'),
                    shell=True,
                    stdout=PIPE,
                    stderr=STDOUT,
                    encoding='utf-8',
            ) as p:

I'm using Python 3.8 and Django 2.1.5 on Ubuntu 20.04. I run my Django app through a virtual environment.

Is there any hope for a new version fixing this?

Thank you.

Windows: OSError: symbolic link privaledge not held

I am trying to run this on Windows 10 and receiving the following error: OSError: symbolic link privilege not held. Is there a way to accomplish the same thing without using symlinks for Windows users?

The error is caused by line 16 of npminstall.py.

Suggestion to drop NODE_PACKAGE_MANAGER_EXECUTABLE in favor of using npm cmd

Hi! Having to manage your executable directory across environments is going to be a bit painful.

I have to configure locally

NODE_PACKAGE_MANAGER_EXECUTABLE = "C:\\Users\\andre\\AppData\\Roaming\\npm\\npm.cmd"

and a different config is needed for CI.

My suggestion is instead to natively use the npm command directly, and therefor require every environment to have npm installed globally. You can then remove the config all together.

python manage.py collectstatic installs devDependencies

As the title indicate, static collection also installs devDepdencies, this bloats the static folder immensely.

My suggestion is that it by default dont do this, i believe you need to do something like npm install --omit=dev (ref)

package.json

  "dependencies": {
    "jquery": "^3.7.0"
  },
  "devDependencies": {
    "@jest/globals": "^29.3.1",
    "@types/jquery": "^3.5.16",
    "@types/jquery.slimscroll": "^1.3.31",
    "@types/jqueryui": "^1.12.16",
    "@types/kineticjs": "^0.0.29",
    "eslint": "^8.30.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-jsdoc": "^39.6.4",
    "eslint-plugin-n": "^15.6.0",
    "eslint-plugin-promise": "^6.1.1",
    "eslint-plugin-simple-import-sort": "^8.0.0",
    "jest": "^29.3.1",
    "jsdom": "^20.0.3",
    "typescript": "^4.9.4"
  },

python manage.py collectstatic output
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.