Giter Site home page Giter Site logo

Comments (11)

jpcamara avatar jpcamara commented on June 11, 2024

Have you tried using https://github.com/jaredhanson/deamdify?

from famous.

mizchi avatar mizchi commented on June 11, 2024

Oops, closing and reopen are my faults.

I tried deamdify now. Thanks to @jpcamara .
I need to rename to famous/ to ../ for example require('famous/core/Engine') to require('../core/Engine')

dirs

famous/
main.js

And exec browserify -t deamdify main.js -o bundle.js makes bundle.js. yeah!

main.js is here.

var Engine = require('./famous/core/Engine');

It works but need many procedures. (and need to merge manually after that)
I tried aliasify but looks not active to AMD.

Anyway, if this way are refined, common.js users can use famo.us easily but only common.js users. Almost develpper can't choose their own building system under constructuring.

My point of view is current using way is only for requirejs. I think providing all included file are easy to use if famous can.

from famous.

jodyheavener avatar jodyheavener commented on June 11, 2024

I'd also be interested in seeing a version that doesn't use require.js.

from famous.

MylesBorins avatar MylesBorins commented on June 11, 2024

For what it is worth you can change the name space in the requirejs config
which is bundled with the yo scaffolded base project. You could also
consider looking at the project browserify-ftw which is used to convert
require to common.

I personally have not played with either but I know @andredeandarade has.
On Apr 15, 2014 9:54 AM, "jodyheavener" [email protected] wrote:

I'd also be interested in seeing support for not needing require.js.


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-40506067
.

from famous.

jdiaz5513 avatar jdiaz5513 commented on June 11, 2024

browserify-ftw worked wonders for me; you only need a minimal config to get it working.

Make sure there's nothing else in your working directory besides the famous folder before you do this, or browserify-ftw might mess with them too! Create these three files in the directory containing the main famous folder:

require.js
require.config({ paths: {} });
entry.js
define([],function(){});
config.js
module.exports = { indent: 0, dryrun: false };

Then run browserify-ftw -r require.js -c config.js -e entry.js.

It'll transform all the files in place (and create a few extra files outside of the famous folder). You can delete all the extra files when you're done.

While this works, it sure as hell is clunky so I might start working on forking a brunch skeleton for Famous that uses the CommonJS format.

from famous.

andrewdeandrade avatar andrewdeandrade commented on June 11, 2024

@jdiaz5513 Let me know how browserify-ftw could be modified (beyond your instructions above) to get it working out of the box with no modifications. If it is reasonable, I can submit another pull request to browserify-ftw since I'm already familiar with that repo (since I made most of the changes that allow it to work nicely with famous code). I'm particularly interested in knowing the reason why those changes you made were necessary. i.e. what side effects did you observe without them that were undesirable? (FWIW I used browserify-ftw as a library and not as a CLI tool, so I'm not familiar with its CLI behavior).

To make things easier for others and to make this repeatable in other repos, add the following script to ~/bin and chmod +x it.

#!/bin/sh
set -eu
command -v browserify-ftw >/dev/null 2>&1 || { npm install -f browserify-ftw; }
DIR=`pwd`
REQUIRE=$DIR/require.js; ENTRY=$DIR/entry.js; CONFIG=$DIR/config.js
FILES=( $REQUIRE $ENTRY $CONFIG )
for i in "${FILES[@]}"
do
  [ -f $i ] && { echo "${i} already exists. aborting"; exit 1; }
done
echo "require.config({ paths: {} });" > $REQUIRE
echo "define([],function(){});" > $ENTRY
echo "module.exports = { indent: 0, dryrun: false };" > $CONFIG
browserify-ftw -r $REQUIRE -c $CONFIG -e $ENTRY
rm $REQUIRE $ENTRY $CONFIG

from famous.

jdiaz5513 avatar jdiaz5513 commented on June 11, 2024

The indent behavior for me was odd.

I was expecting {indent: 2} to refactor all the code to an indent spacing of two, but instead what it (appears) to do is leave the require statements at indent level 0, and then everything below it got an indent of 2. I don't really see how that is useful at all?

The browserify-ftw command-line would be super useful if it had an option to just target a specific folder in "library mode", with the above config implied. No main entrypoint, do not generate browserify bundle build files, and add a flag to disable dryrun so you don't need a refactor config file either.

It should be as simple as this: browserify-ftw --library --folder famous/ --dryrun false

I'll have to look into using browserify-ftw as a library, maybe that'll be illuminating (I was assuming it was just a CLI tool).

from famous.

aelr avatar aelr commented on June 11, 2024

@mizchi @jdiaz5513 I put together a port of Famo.us to CommonJS here: https://github.com/aelr/famous-commonjs

from famous.

mizchi avatar mizchi commented on June 11, 2024

@aelr Great! And I created global namespace version by use your modules.
https://github.com/mizchi/famous-bundled

What I want is this repository's famous.min.js. It is fork so I can't maintaine.

from famous.

qrg avatar qrg commented on June 11, 2024

👍

from famous.

MylesBorins avatar MylesBorins commented on June 11, 2024

I'm closing this for right now. Please feel free to reopen if you do not feel like you found the necessary answers in here

from famous.

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.