here is my folder structure
app
index.html
css folder
js folder
src folder
build
index.html
minified css
minified js
my src folder has angular.min.js and all other supporting files. Now I run grunt and move all css html and js files to build folder. But html is still referring to app/src folder which is not inside build. I don't want to create one more src folder inside build. I want to refer same folder which is inside app from build/index.html. How can I do these changes when I run grunt?
If it's just relative paths that you need to update in your built source files, you can always use something like grunt-rewrite to do a global glob find/replace. It's fast, it's easy to configure, and doesn't muck with your source.
Related
Is there a way to check if any assets in your src folder in your React app are not imported in any components?
To check if there are any assets in your src folder that are not imported in any components, you can use the Webpack Bundle Analyzer. This tool generates a report that shows the contents of your app's bundle, including a list of all the assets that are included.
To use the Webpack Bundle Analyzer, you can follow the instructions in this blog post: https://blog.jakoblind.no/webpack-bundle-analyzer/
Once you have installed and configured the tool, you can run it to generate a report that shows the contents of your app's bundle. You can then use this report to see if there are any assets in your src folder that are not included in the bundle, which would indicate that they are not being imported in any of your components.
I ran the react build script and it has built the files into a build folder. However when I use serve (or any static file serve package), I am able to see the files from the src folder when I check the inspector. The react components files can be seen from the inspector.
The actual directory structure
The files in the chrome inspector
How can I solve this issue?
i am trying trying to create a project with webpack, angular and gulp. Webpack creates a bundle file called build.js and an index.html from a template. When the browser enters the webpage i want it to go directly to a login screen by using ui-route.
this is how my directory structure looks like.
Firstly my problem is that the bundle only includes the entry file, app.module.js. I can require the other js files in app.module.js to have them in the bundle to but when this project grows it will be a lot of files to be required in one file. So is it possible to bundle all js files except the once in node_modules folder?
My next problem is that when the build.js and index.html has been created in the dist/build folder i cant seem to find the rest of the html files in the project if they are not in the build folder.
Not sure how your webpack config looks like, but many times the HTML is processed by webpack and might end up in your JS bundle (as a string) that then can be used by Angular.
I am working on a Spring boot web project. I have an index.html file under src/main/webapp, and a .js file under src/main/resources/static/js.
Eclipse is complaining on the <script></script> inclusion inside the index.html file: Undefined Javascript file.
The above is also the case for css files under src/main/resources/static/css.
In addition, I'm using wro to generate unified angularjs-bootstrap js and css files, which are generated under target\generated-resources\static and Eclipse cannot find them either.
Is there any way to configure Eclipse to include the above directories?
The javascript and css files must be placed under src/main/webapp so that they go in the correct location when the final WAR is built. Files placed under src/main/resources will be placed in the java class path of the WAR when it is deployed (i.e., under the classes directory of the WAR). You should update your project by placing css/javascript files under src/main/webapp. wro can also be configured to work properly with eclipse see: CSS and JS minification using Eclipse, Maven and WRO4J
When using Yeoman with the angular generator, I build a dist by running grunt. This works great but my question is that why does the dist folder also contain all the bower components when I actually just need the min.js ones.
Is there a setting in the grunt file I can hack to get only the min.js files in a vendor folder, to keep the dist. as small as possible?
I am currently manually creating a vendor folder and copying the min.js files to it referencing them in my index.html, but it would be great if I could automate that.
This is way Yeoman create the project and the grunt file. So you can customize the grunt.js file in order to omit the unwanted files.
In the grunt.js file replace the 'bower_components/**/*', to 'bower_components/**/*.min.js',
This will copy only the min.js files.
Hope this will help.