how to use cookiecutter-django scss - node.js

I used the recent cookiecutter django package to generate a new django product. But I am having trouble with the sass/scss compilation aspect.
I looked at this, and its no help, as I need to setup the package.json to run any commands.
I tried to make one, but I cannot seem to get it to run.
{
"name": "my_awesome_project",
"version": "1.0.0",
"description": "My Awesome Project ==================",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"scss": "sass --load-path my_awesome_project/static/sass/ my_awesome_project/static/css/a.css"
},
"author": "",
"license": "ISC",
"dependencies": {
"compass": "^0.1.1"
}
}
In all honesty, I don't really know what Im doing with this part, nor where to start.

Related

"/" is not recognized as an internal or external command

Today, I'm coding a few npm packages and a few things that need to be prepared repeatedly.
So I wanted to code a CLI to get those things done quickly.
Here is the src/cli.js code:
export function cli(args){
console.log(args);
}
Here is the package.json code:
{
"name": "my-project",
"version": "1.0.0",
"description": "A CLI to bootstrap new project",
"main": "src/index.js",
"bin": {
"#kensoni/my-project": "bin/my-project",
"my-project": "bin/my-project"
},
"publishConfig": {
"access": "public"
},
"keywords": [
"cli"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ken Nguyen",
"license": "MIT",
"dependencies": {
"arg": "^5.0.0",
"esm": "^3.2.25",
"inquirer": "^8.1.1"
}
}
Here is the bin/my-project code:
#!/usr/bin/env/ node
require = require('esm')(module /*, options*/);
require('../src/cli').cli(process.argv);
After I execute the command npm link and open a new cmd type my-project, I get the following message:
'"/"' is not recognized as an internal or external command,
operable program or batch file.
I am using these versions:
node: 14.17.1
npm: 7.18.1
Any ideas how it might work.
Thanks in advance.
Remove "/" after env
#!/usr/bin/env node
//...

Nodejs modularized aws-sdk v3 size getting increased

I am trying to reduce size of nodejs lambda bundle which uses aws-sdk.
This is the original lambda package.json file:
{
"name": "lambdanodejs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "^2.784.0",
"bluebird": "^3.7.2",
"ioredis": "^4.19.2",
"redis": "^3.0.2",
"redis-clustr": "^1.7.0"
}
}
Overall size is 57MB, 54 belongs to aws-sdk.
To reduce size I tried using specific client services (v3 sdk).
Followed : https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-secrets-manager/package.json
{
"name": "lambdanodejs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"#aws-sdk/client-dynamodb": "^3.7.0",
"#aws-sdk/client-secrets-manager": "^3.7.0",
"bluebird": "^3.7.2",
"ioredis": "^4.19.2",
"redis": "^3.0.2",
"redis-clustr": "^1.7.0"
}
}
Now npm install results in even larger size around 190+MBs.
Also in node_modules I see lot of directories which were not there when using previous package.json install.
This v3 aws-sdk is supposed to be lighter.
Am I missing something?
Thanks!
Don't push aws-sdk to the lambda function. If you want to use it in the local development environment install it globally.
Lambda will provide all necessary SDK modules(v2 & v3) during runtime, just import them in the code.
Don't bundle the aws-sdk in the zip.
If your zip size is getting increased, use layers in lambda.
Import the node_moudles to lambda layers.
Then upload your code to lambda.

electron-forge: Supposedly missing dependencies of git and node but both appear in package.json

I put in the terminal: electron-forge import, and I get this message:
It looks like you are missing some dependencies you need to get Electron running.
Make sure you have git installed and Node.js version 6.0.0+
But this is my package.json:
{
"name": "memoryassitant-electron",
"version": "1.0.0",
"description": "software para estudiantes de asistencia en procesos de memorización de información diversa",
"main": "index.js",
"dependencies": {
"electron-forge": "^5.2.4",
"git": "^0.1.5",
"node": "^14.0.0"
},
"devDependencies": {
"electron": "^8.2.3"
},
"scripts": {
"test": "test",
"dev": "electron index.js",
"test1": "electron frontend.html",
"installer1": "electron-forge import"
},
"keywords": [
"memory",
"learning",
"asistant"
],
"author": "Guillermo Baldán",
"license": "ISC"
}
As you can see I have git (^0.1.5) and node (^14.0.0) supposedly installed. I don´t understand why I get this error.
How can I solve it?
The problem is solved in the comments of this question:
Error Message: It looks like you are missing some dependencies you need to get Electron running

npm link is not working, bash: dosmth: command not found

I am trying to do basic CLI with node, but seems like it is not linking from/to correct directory.
I have file named create, which contains command: console.log(process.cwd());
When I run in bash node create, it gives me that outcome:
/Users/katya/Desktop/code/drawer.
However, after running npm link (or sudo npm link), it prints that:
/Users/katya/.npm-packages/bin/dosmth -> /Users/katya/.npm-packages/lib/node_modules/drawer/create
/Users/katya/.npm-packages/lib/node_modules/drawer -> /Users/katya/Desktop/code/drawer
and after that if I run dosmth in bash I get:
bash: dosmth: command not found
I assume there is something to do with ./npm-packages/ appearing in the path.
I tried to delete node completely from computer and install again but did not help.
If you have any idea I would really appreciate your help.
My package.json:
{
"name": "drawer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": {
"dosmth": "create"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Have you tried changing bin to point to your index.js?
{
// Other keys ...
"bin": {
"dosmth": "./index.js"
},
//...
}

Npm scripts - Critical css

I'm using Addy Osmani's 'Critical'
https://github.com/addyosmani/critical
the package.json below is working fine, but the build is only copying the critical css not extracting. I've tried --extract multiple places with and without a defined stylesheet, it seems i cant wrap my head around it.
{
"name": "boilerplate",
"version": "1.0.0",
"main": "index.js",
"repository": "",
"author": "",
"license": "MIT",
"scripts": {
"build:critical": "critical index.html --minify --css dist/css/style.css > dist/css/critical.css",
},
"devDependencies": {
"critical": "^0.8.1",
}
}
If you output a HTML file instead, the CSS will be extracted. I had the same issue. Furthermore, in the output index file, the CSS link will have a rel="preload" automatically.
Here it's the command I am using:
critical dist/public/index.html --base dist/public --inline --minify > dist/public/index.critical.html
I hope that it will help.

Resources