Code Monkey home page Code Monkey logo

Comments (9)

srod avatar srod commented on June 4, 2024

Can't you require without the path ?
require('node-minify') is not working ?

from node-minify.

sorabh86 avatar sorabh86 commented on June 4, 2024

If i will create or move your example file to desktop directory those also not works, because file is using ../libs/node-minify mean an relative path to load module.
So my answer is that's not working and i do like to use without path and don't know so much about nodejs i used an bash file to hack it little just get path.

from node-minify.

srod avatar srod commented on June 4, 2024

Please, don't use ../libs/node-minify, I will change that.
Just use : require('node-minify')

from node-minify.

sorabh86 avatar sorabh86 commented on June 4, 2024

Here is my code, i have just create shortcut to run this file with nodejs on sublime text. it will compress all code/*.js files. but i do have to use full path to node-minify.js to work it right.
I do also update node-minify module on npm globally, but its only works with absolute path, not work as global modules installed on npm.
var http = require('http'),
compressor = require('C:/Users/name/AppData/Roaming/npm/node_modules/node-minify/lib/node-minify'),
server = http.createServer(function(req,res) {
res.writeHead(200,{'Content-Type':'text/plain'});
res.end('Hello World\n');
});

server.listen(1225, function() { //'listening' listener
console.log('Server running at http://127.0.0.1:1225/');
});

new compressor.minify({
type: 'gcc',
language: 'ECMASCRIPT5',
fileIn: [ 'code/jquery-1.10.2.min.js',
'code/js/view-json.js',
'code/js/jhint.js'],
fileOut: 'js/bundle.js',
callback: function(err, min){
console.log('GCC jquery 2.0');
console.log(err);
//console.log(min);
server.close();
}
});

from node-minify.

srod avatar srod commented on June 4, 2024

Thank you for the code, I will try as soon as possible.

from node-minify.

sorabh86 avatar sorabh86 commented on June 4, 2024

No problem, you can take as much as time, if i do manage to solve it i will send you request for changes.
Also want to tell you, i don't know its important or not but when i try other modules on command line those those also have an command line option like for express you can use type "express yourprojectname" and this will create new project with express configuration there is more, i think its work with bash or cmd files. but its not related to define modules globally.

from node-minify.

srod avatar srod commented on June 4, 2024

I just try your code, and it's working fine for me.
Maybe you are facing an issue with the NODE_PATH env : http://stackoverflow.com/questions/12594541/npm-global-install-cannot-find-module

Try an echo of $NODE_PATH, and check it.
If it's empty or wrong, set it in your shell :

export NODE_PATH=/path/to/node_modules

And for the other point, the command line is not available.
But it could be a good feature, require some developments.

from node-minify.

sorabh86 avatar sorabh86 commented on June 4, 2024

Thank for help, this is very useful information. i don't know its automatically find global modules from $NODE_PATH environment variable.

from node-minify.

srod avatar srod commented on June 4, 2024

You're welcome :)

from node-minify.

Related Issues (20)

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.